<template>
  <div style="height: 100%; width: 100%; position: relative">
      <!-- 顶部查询窗口 -->
      <div class="pagetop" :style="'height:' + topheight + 'px;'" ref="topwindow">
          <template>
              <div>
                  <div style="float: left; width: 100%">
                      <table style="white-space:nowrap;">
                          <tr>
                              <td width="40px">日期</td>
                              <td>
                                  <el-date-picker v-model="queryDate[0]" type="date" placeholder="开始日期" value-format="yyyy-MM-dd" @change="queryDate_change" style="width: 130px" :clearable="false"></el-date-picker> ~
                                  <el-date-picker v-model="queryDate[1]" type="date" placeholder="结束日期" value-format="yyyy-MM-dd" @change="queryDate_change" style="width: 130px" :clearable="false"></el-date-picker>
                              </td>
                              <!-- <td v-if="true">
                              <td>
                              <td v-if="true">
                              <td> -->
                              <td width="60px">检验仪器</td>
                              <td>
                                  <rm-ddl-instrument @change="yq_change" width="202px" v-model="instrId" defaultflag="1" prgno="LIS530" :clearable="false" :bPower="true"></rm-ddl-instrument>
                              </td>
                              <!-- <td width="10px"></td> -->
                              <td align="right" style="text-align: left;padding: 0px 15px;">
                                  <!-- <el-radiio v-model="allbatch" style="padding: 0px 15px" size="mini" @change="allbatch_change"> -->
                                  <el-radio v-model="allbatch" label="0" @change="allbatch_change">单批号</el-radio>
                                  <el-radio v-model="allbatch" label="1" @change="allbatch_change">不分批号</el-radio>
                                  <el-radio v-model="allbatch" label="2" @change="allbatch_change">批号多选</el-radio>
                                  <!-- </el-radio> -->

                                  <!-- <el-checkbox style="margin: 0px 5px;" v-model="multi" true-label="1" false-label="0">多图</el-checkbox>

                                  <el-checkbox style="margin: 0px 5px;" v-model="showother" true-label="1" false-label="0">显示非累计点</el-checkbox> -->
                              </td>
                              <td>
                                  <el-checkbox v-model="showallbatch" size="mini" true-label="1" false-label="0" @change="queryDate_change">显示所有批号</el-checkbox>
                              </td>
                              <td>

                              </td>
                          </tr>
                          <tr>
                              <td align="left" colspan="4">
                                  <el-checkbox-group v-model="queryQclevel" size="mini" style="text-align: left;padding-left:15px">
                                      <el-checkbox style="min-width:35px" @change="qclevel_change" v-for="(qclevel, index) in queryQclevels" :key="index" :label="qclevel.label" :disabled="setQclevelDisabled(qclevel)">{{ qclevel.label }}</el-checkbox>
                                  </el-checkbox-group>
                              </td>
                              <!-- <td width="10px"></td> -->
                              <!-- <td></td> -->
                              <!-- <td width="60px">医院</td>
                              <td>
                                  <rm-ddl-common @change="hospitalchange" datatype="hospital" dataname="医院" v-model="hospitalval" width="200px"></rm-ddl-common>
                              </td> -->
                              <td colspan="1" style="text-align: left;padding: 0px 15px;">
                                  <!-- <el-radio-group v-model="gtype" @change="getTableDataShow" size="mini"> -->
                                  <el-radio v-model="gtype" label="0" @change="getTableDataShow">所有点</el-radio>
                                  <el-radio style="width:67px" v-model="gtype" label="1" @change="getTableDataShow">最后点</el-radio>
                                  <el-radio v-model="gtype" label="2" @change="getTableDataShow">最好点</el-radio>
                                  <!-- </el-radio-group> -->
                              </td>
                              <td :colspan="2" style="text-align: right">
                                  <!-- 刷新(F8) -->
                                  <!-- 签名(F9) -->
                                  <!-- 打印(F10) -->
                                  <!-- 打印预览(F11) -->
                                  <el-button style="margin: 0px 0px 0px 0px" icon="el-icon-search" @click="getData()" v-has="'PINQUERY'">刷新</el-button>
                                  <el-button icon="el-icon-news" @click="preqcsign()">签名</el-button>
                                  <el-dropdown style="margin-left: 10px;" trigger="click" size="mini">
                                      <el-button :clickDelay="0">
                                          批次审查<i class="el-icon-arrow-down el-icon--right"></i>
                                      </el-button>
                                      <el-dropdown-menu slot="dropdown">
                                          <div>
                                              <el-button icon="el-icon-tickets" @click="qccalc()">判定待判定的标本</el-button>
                                          </div>
                                          <div>
                                              <el-button icon="el-icon-tickets" @click="qccalcpre()">重新判定区间数据</el-button>
                                          </div>
                                      </el-dropdown-menu>
                                  </el-dropdown>
                                  <el-dropdown style="margin-left: 10px;" trigger="click" size="mini">
                                      <el-button :clickDelay="0">
                                          打印/预览<i class="el-icon-arrow-down el-icon--right"></i>
                                      </el-button>
                                      <el-dropdown-menu slot="dropdown">
                                          <div>
                                              <el-button icon="el-icon-printer" @click="qcprint_click()">打印</el-button>
                                          </div>
                                          <div>
                                              <el-button icon="el-icon-tickets" @click="qcprint_preview_click()">预览</el-button>
                                          </div>
                                      </el-dropdown-menu>
                                  </el-dropdown>
                                  <el-button style="margin-left: 10px;" v-if="isqchelpouthanding" icon="el-icon-view" @click="outcontrolshow()">失控处理流程</el-button>
                                  <el-dropdown style="margin-left: 10px;" trigger="click" size="mini">
                                      <el-button :clickDelay="0">
                                          更多操作<i class="el-icon-arrow-down el-icon--right"></i>
                                      </el-button>
                                      <el-dropdown-menu slot="dropdown">
                                          <div> <el-button @click="targetSet_click()">
                                                  靶值设定
                                              </el-button></div>
                                          <div>
                                              <el-checkbox v-model="slvshownum" size="mini" true-label="1" false-label="0" @change="queryDate_change">单水平单批号时Y轴显示数值</el-checkbox>
                                          </div>
                                          <div>
                                              <el-checkbox v-model="slvshowdiagnose" size="mini" true-label="1" false-label="0">未判定时显示诊断</el-checkbox>
                                          </div>
                                          <div>
                                              <el-checkbox v-model="bCategory" size="mini" @change="queryDate_change">同日画图点垂直连线显示</el-checkbox>
                                          </div>
                                          <!-- <el-dropdown-item @click.native="$refs.rmlabreport.OpenConfig()">设置</el-dropdown-item> -->
                                      </el-dropdown-menu>
                                  </el-dropdown>
                              </td>
                          </tr>
                      </table>
                  </div>
              </div>
          </template>
      </div>
      <!-- 上方分隔条 -->
      <div class="xsplit" :style="'top:' + topheight + 'px;'" @mousedown="xtopmousedown"></div>
      <!-- 主画面 -->
      <div class="pagecenter" :style="'top:' + (topheight + 5) + 'px;bottom:' + (bottomheight + 5) + 'px;'">
          <!-- 左边list列表 -->
          <div v-if="allbatch != '1'" class="middle-center" :style="'left:' + leftwidth + 'px;right:' + (rightwidth + 5) + 'px;'" id="leftGrid">
              <rm-layout-top splitcolor="#F8F8FF" :splitwidth="1" :fixsize="allbatch != '1'?170:0" :canDrag="true">
                  <template v-slot:fix>
                      <div style="height:100%">
                              <el-input v-model="txtsearchbatch" placeholder="搜索批号" style="width:100%;height:30px">
                              </el-input>
                          <div style='height:calc(100% - 33px)'>
                              <vxe-table v-if="allbatch != '1'" ref="xTableB" width="100%" height="100%" style="margin: 0px 0px 3px 0px;height:100%" :select-config="{ reserve: true }" :data.sync="batchlist" border size="mini" :mouse-config="{ selected: true }" show-header-overflow highlight-current-row highlight-hover-row resizable stripe @current-change="batch_change" @select-change="batch_selectChange" @select-all="batch_selectChange" :sort-config="{ trigger: 'cell' }">
                                  <vxe-table-column v-if="allbatch == '2'" type="selection" width="30" align="center"></vxe-table-column>
                                  <vxe-table-column field="batchno" title="批号" width="50%" align="center" sortable></vxe-table-column>
                                  <vxe-table-column field="maxstartdt" title="启用日期" width="40%" header-align="center" :formatter="['toDateString', 'yyyy-MM-dd']" sortable></vxe-table-column>
                              </vxe-table>
                          </div>
                          <!-- <div v-else>
                      <el-input v-model="txtsearch" placeholder="项目编号|项目名称|输入码" style="width:100%">
                      </el-input>
                  </div> -->
                      </div>
                  </template>
                  <!-- :keyboard-config="keyConfig" -->
                  <div style="height:100%">
                      <vxe-table ref="xTableR" width="100%"    height="100%"  style="height:auto" :select-config="{ reserve: true }" :data.sync="rptitemlist" border size="mini" :mouse-config="{ selected: true }" show-header-overflow highlight-current-row highlight-hover-row resizable stripe :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }" @current-change="rptitem_change" :keyboard-local-config="keyConfigItem">
                          <vxe-table-column field="itemcode_en" title="项目编号" width="40%" header-align="center"></vxe-table-column>
                          <vxe-table-column field="showname" title="项目名称" width="60%" header-align="center"> <template v-slot="{ row }">
                                  <el-tooltip style="background-color: transparent;" v-if="row.outcnt > 0 " effect="dark" :content="`失控数:${row.outcnt}           处理数:${row.outokcnt}  `" placement="right">
                                      <input v-model="row.showname" style="background-color: transparent;border-style:none,border-color:rgba(0,0,0,0);height:100%;outline:none" class="basecss" readonly>
                                  </el-tooltip>
                                  <input v-else v-model="row.showname" style="background-color: transparent;border-style:none;border-color:rgba(0,0,0,0);height:100%;outline:none" class="basecss" readonly>
                              </template></vxe-table-column>
                      </vxe-table>
                  </div>
              </rm-layout-top>
          </div>
          <div v-else class="middle-center" :style="'left:' + leftwidth + 'px;right:' + (rightwidth + 5) + 'px;'">
              <el-input v-model="txtsearch" placeholder="搜索 项目编号|项目名称|输入码" style="width:100%;height:30px">
              </el-input>
              <div style="height:calc(100% - 30px)">
                  <vxe-table ref="xTableR" width="100%" height="100%" key="rptkey" :select-config="{ reserve: true }" :data.sync="rptitemlist" border size="mini" :mouse-config="{ selected: true }" show-header-overflow highlight-current-row highlight-hover-row resizable stripe :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }" @current-change="rptitem_change" :keyboard-local-config="keyConfigItem">
                      <vxe-table-column field="itemcode_en" title="项目编号" width="40%" header-align="center"></vxe-table-column>
                      <vxe-table-column field="showname" title="项目名称" width="60%" header-align="center"> <template v-slot="{ row }">
                              <el-tooltip style="background-color: transparent;" v-if="row.outcnt > 0 " effect="dark" :content="`失控数:${row.outcnt}           处理数:${row.outokcnt}  `" placement="right">
                                  <input v-model="row.showname" style="background-color: transparent;border-style:none,border-color:rgba(0,0,0,0);height:100%;outline:none" class="basecss" readonly>
                              </el-tooltip>
                              <input v-else v-model="row.showname" style="background-color: transparent;border-style:none;border-color:rgba(0,0,0,0);height:100%;outline:none" class="basecss" readonly>
                          </template></vxe-table-column>
                  </vxe-table>
              </div>
          </div>

          <!-- 右边分割条 -->
          <div class="ysplit" :style="'right:' + rightwidth + 'px;'" @mousedown="yrightmousedown"></div>
          <!-- 右边数据展现tab -->
          <div class="middle-right" :style="'width:' + rightwidth + 'px;'">
              <el-tabs style="height: 100%" type="border-card" v-model="tabsValue" @tab-click="tab_changed" ref="lis530righttab">
                  <el-tab-pane label="图形">
                      <div id="qcChart" style="width: 100%; height: 75%; margin: 2px"></div>
                      <vxe-table class="basecss" ref="xTableShowLines" width="100%" height="24%" :select-config="{ reserve: true }" :data.sync="tableDataLinesunion" border size="mini" show-header-overflow highlight-current-row highlight-hover-row resizable stripe :cell-class-name="xTableRCellClassName">
                          <vxe-table-column field="lineLevel" title="水平" width="40px" align="center"></vxe-table-column>
                          <vxe-table-column field="lineBatch" title="批号" width="160px" align="center">
                              <template v-slot="{ row }">
                                  <el-input style="print" v-model="row.lineBatch" type="textarea" autosize readonly></el-input>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="lineName" title="名称" width="160px" align="center">
                              <template v-slot="{ row }">
                                  <el-input style="print" v-model="row.lineName" type="textarea" autosize readonly></el-input>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="lineTagvalue" title="靶值  x̅" width="130px" align="center" v-if="qcrule.qcruletype != '4'">
                              <template v-slot="{ row }">
                                  <el-input style="print" v-model="row.lineTagvalue" type="textarea" autosize readonly></el-input>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="lineSd" title="标准差SD" width="140px" align="center" v-if="qcrule.qcruletype != '4'"> <template v-slot="{ row }">
                                  <el-input style="print" v-model="row.lineSd" type="textarea" autosize readonly></el-input>
                              </template></vxe-table-column>
                          <vxe-table-column field="lineCv" title="变异系数CV" width="140px" align="center" v-if="qcrule.qcruletype != '4'"><template v-slot="{ row }">
                                  <el-input style="print" v-model="row.lineCv" type="textarea" autosize readonly></el-input>
                              </template></vxe-table-column>
                          <vxe-table-column field="lineTagvalueunion" title="当前均值" width="70px" align="center" v-if="qcrule.qcruletype != '4'"></vxe-table-column>
                          <vxe-table-column field="lineSdunion" title="当前SD" width="70px" align="center" v-if="qcrule.qcruletype != '4'"></vxe-table-column>
                          <vxe-table-column field="lineCvunion" title="当前CV" width="70px" align="center" v-if="qcrule.qcruletype != '4'"></vxe-table-column>
                          <vxe-table-column field="normallineTagvalueunion" :title="renamecurrentcontrol+'均值'" width="80px" align="center" v-if="qcrule.qcruletype != '4'"></vxe-table-column>
                          <vxe-table-column field="normallineSdunion" :title="renamecurrentcontrol+'SD'" width="80px" align="center" v-if="qcrule.qcruletype != '4'"></vxe-table-column>
                          <vxe-table-column field="normallineCvunion" :title="renamecurrentcontrol+'CV'" width="80px" align="center" v-if="qcrule.qcruletype != '4'"></vxe-table-column>
                          <vxe-table-column field="mnlineTagvalueunion" title="本月去失控均值" width="100px" align="center" v-if="qcrule.qcruletype != '4'&&showmonthincontrol == '1'"></vxe-table-column>
                          <vxe-table-column field="mnlineSdunion" title="本月去失控SD" width="100px" align="center" v-if="qcrule.qcruletype != '4' &&showmonthincontrol == '1'"></vxe-table-column>
                          <vxe-table-column field="mnlineCvunion" title="本月去失控CV" width="100px" align="center" v-if="qcrule.qcruletype != '4'&&showmonthincontrol == '1'"></vxe-table-column>
                          <vxe-table-column field="cumlineTagvalueunion" title="累积去失控均值" width="150px" align="center" v-if="qcrule.qcruletype != '4'&&showcumcontrol == '1'"><template v-slot="{ row }">
                                  <el-input style="print" v-model="row.cumlineTagvalueunion" type="textarea" autosize readonly></el-input>
                              </template></vxe-table-column>
                          <vxe-table-column field="cumlineSdunion" title="累积去失控SD" width="150px" align="center" v-if="qcrule.qcruletype != '4' &&showcumcontrol == '1'">
                              <template v-slot="{ row }">
                                  <el-input style="print" v-model="row.cumlineSdunion" type="textarea" autosize readonly></el-input>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="cumlineCvunion" title="累积去失控CV" width="150px" align="center" v-if="qcrule.qcruletype != '4'&&showcumcontrol == '1'">
                              <template v-slot="{ row }">
                                  <el-input style="print" v-model="row.cumlineCvunion" type="textarea" autosize readonly></el-input>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="lineExpriedt" title="有效期" width="150px" align="center"><template v-slot="{ row }">
                                  <el-input style="print" v-model="row.lineExpriedt" type="textarea" autosize readonly></el-input>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="lineNum" title="数量" width="40px" align="center"></vxe-table-column>
                          <vxe-table-column field="lineComm" title="备注" width="200px" align="center"><template v-slot="{ row }">
                                  <el-input style="print" v-model="row.lineComm" type="textarea" autosize readonly></el-input>
                              </template>
                          </vxe-table-column>
                      </vxe-table>
                  </el-tab-pane>
                  <el-tab-pane label="有效数据">
                      <div align="right" style="width: 100%; padding: 0px 0px 5px 0px; font-size: 12px; height: 26px">
                          <el-button icon="el-icon-printer" @click="btnPrintData('print')" v-has="'PMODIFY'">打印</el-button>
                          <el-button icon="el-icon-edit-outline" @click="btnPrintData('design')" v-has="'PMODIFY'">样式设计</el-button>
                      </div>
                      <div style="width: 100%; overflow: auto; top: 28px; position: absolute; bottom: 0px">
                          <vxe-table ref="xTableShow" width="100%" height="auto" :select-config="{ reserve: true }" :data.sync="tableDataShow" border size="mini" show-header-overflow highlight-current-row highlight-hover-row resizable stripe :key="showDataKey" :cell-class-name="getOutcontrolClassnameShow" :saveCustomColumnData="saveCustomColumnData" :loadCustomColumnData="loadCustomColumnData">
                              <vxe-table-column field="qcdate" title="日期" width="100px" align="center"></vxe-table-column>
                              <vxe-table-column field="seq" title="序号" width="50px" align="center"></vxe-table-column>
                              <template v-for="(item, index) in queryQclevel">
                                  <vxe-table-column :key="'col' + index" :title="item" width="110" sortable align="center">
                                      <vxe-table-column :key="index" :field="'val' + transtQclevel(item)" :title="'测定值'" width="80px" header-align="center" align="right"></vxe-table-column>
                                      <vxe-table-column :key="'index' + index" :field="'sd' + transtQclevel(item)" :title="'  SD'" width="70px" header-align="center" align="right" :formatter="colformatter"></vxe-table-column>
                                  </vxe-table-column>
                              </template>
                          </vxe-table>
                      </div>
                  </el-tab-pane>
                  <el-tab-pane label="所有数据">
                      <div align="left" style="width: 100%; padding: 0px 0px 5px 0px; font-size: 12px; height: 30px">
                        
                          <el-radio-group v-model="allDataVisible" @change="allDate_change" size="mini" style="height: 26px; position: relative; top: 22%">
                              <el-radio label="0">当前项目数据</el-radio>
                              <el-radio label="1">所有项目数据</el-radio>
                          </el-radio-group>
                          &ensp;
                          <el-date-picker v-if="allDataVisible == '1'" v-model="queryDateAll[0]" type="date" placeholder="开始日期" value-format="yyyy-MM-dd" @change="rptitemAllSelect_change()" style="width: 110px" :clearable="false" :disabled="allDataVisible == '0'" :key="'starkey1' + datekey"></el-date-picker>
                          <nobr v-if="allDataVisible == '1'">~</nobr>
                          <el-date-picker v-if="allDataVisible == '1'" v-model="queryDateAll[1]" type="date" placeholder="结束日期" value-format="yyyy-MM-dd" @change="rptitemAllSelect_change()" style="width: 110px" :clearable="false" :disabled="allDataVisible == '0'" :key="'endkey2' + datekey"></el-date-picker>
                          <nobr v-if="allDataVisible == '1'">&ensp;质控项目</nobr>
                          <el-select v-model="rptitemAllSelect" style="width: 140px" placeholder="请选择" @change="rptitemAllSelect_change()" v-if="allDataVisible == '1'" :clearable="true">
                              <el-option v-for="(item, index) in rptitemAll" :key="index" :label="item.label" :value="item.value" :disabled="item.disabled"></el-option>
                          </el-select>
                          &ensp;
                          <el-select v-if="allDataVisible == '1' &&allbatch =='0'" v-model="qclevelAllSelect" style="width: 80px" placeholder="" @change="rptitemAllSelect_change()" clearable>
                              <el-option v-for="(item, index) in qclevelAllEnable" :key="index" :label="item.label" :value="item.value" :disabled="item.disabled"></el-option>
                          </el-select>
                          <el-select v-if="allDataVisible == '1' && allbatch !='0'" v-model="qclevelAllSelect" style="width: 80px" placeholder="" @change="rptitemAllSelect_change()" clearable>
                              <el-option v-for="(item, index) in queryQclevels" :key="index" :label="item.label" :value="item.value" :disabled="item.disabled"></el-option>
                          </el-select>
                          &ensp;
                          <!-- <el-button icon="el-icon-search" type="primary" @click="rptitemAllSelect_change()" v-has="'PINQUERY'" v-if="allDataVisible == '1'">查询</el-button> -->
                          <el-button icon="el-icon-plus" @click="qcdataAllAdd()" v-has="'PADD'" v-if="allDataVisible == '1'&&allbatch=='0'">新增</el-button>
                          <el-button icon="el-icon-plus" @click="openAddDlg()" v-has="'PADD'" v-if="allDataVisible == '1'&&allbatch!='0'">多选新增</el-button>
                          <el-button icon="el-icon-delete-solid" @click="qcdataAllDelete()" v-has="'PDELETE'" v-if="allDataVisible == '1'">删除</el-button>
                          <el-button icon="el-icon-edit-outline" @click="qcdataAllSave()" v-has="'PMODIFY'" v-if="allDataVisible == '1'">保存</el-button>
                      </div>
                      <div style="width: 100%; overflow: auto; top: 32px; position: absolute; bottom: 0px">
                          <vxe-table v-if="allDataVisible == '0'" ref="xTableFull" width="100%" height="100%" :loading="loading" :select-config="{ reserve: true }" :data.sync="tableDataFull" :sort-config="{ trigger: 'cell' }" @cell-dblclick="CurrentDblClick" border size="mini" show-header-overflow highlight-current-row highlight-hover-row resizable stripe :key="fullDataKey" :cell-class-name="getOutcontrolClassname" :keyboard-config="keyConfig">
                              <!-- cp_controlstatus  cp_outcontroltips -->
                              <!-- <vxe-table-column field="cp_controlstatus" title="在控标志" sortable width="80px" :formatter="['formatSelect', controlstatusList]" align="center"></vxe-table-column> -->
                              <vxe-table-column field="cp_controlstatusna" title="在控标志" sortable width="80px" align="center"></vxe-table-column>
                              <vxe-table-column field="qcdate" title="日期" sortable width="100px" :formatter="['toDateString', 'yyyy-MM-dd']" align="center"></vxe-table-column>
                              <vxe-table-column field="qclevel" title="水平" sortable width="60px" align="center"></vxe-table-column>
                              <vxe-table-column field="resultdt" title="结果时间" sortable width="140px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']" align="center"></vxe-table-column>
                              <vxe-table-column field="displayvalue" title="显示结果" width="100px" align="center"></vxe-table-column>
                              <vxe-table-column field="calculatevalue" title="计算结果" width="80px" header-align="center" align="right"></vxe-table-column>
                              <vxe-table-column field="calculatesd" title="计算的SD" width="80px" :formatter="['toFixedString', 4]" header-align="center" align="right"></vxe-table-column>
                              <vxe-table-column field="cp_calculatecv" title="计算的CV" width="80px" :formatter="['toFixedString', 4]" header-align="center" align="right"></vxe-table-column>
                              <!-- <vxe-table-column field="inuseflag" title="累计" width="60px" :formatter="['formatSelect', dgList]" align="center"></vxe-table-column>
                              <vxe-table-column field="drawflag" title="画图" width="60px" :formatter="['formatSelect', dgList]" align="center"></vxe-table-column> -->
                              <vxe-table-column field="inuseflagna" title="累计" width="60px" align="center"></vxe-table-column>
                              <vxe-table-column field="drawflagna" title="画图" width="60px" align="center"></vxe-table-column>
                              <vxe-table-column field="cp_outcontroltips" title="失控提示" width="100px" header-align="center"></vxe-table-column>
                              <vxe-table-column field="tagvalue" title="靶值" width="60px" header-align="center" align="right"></vxe-table-column>
                              <vxe-table-column field="sd" title="SD" width="60px" header-align="center" align="right"></vxe-table-column>

                              <vxe-table-column field="cv" title="CV" width="60px" header-align="center" align="right"></vxe-table-column>
                              <vxe-table-column field="batchno" title=" 批号" width="100px" align="center"></vxe-table-column>
                              <vxe-table-column field="outcontrolreason" title="失控原因" width="100px" header-align="center"></vxe-table-column>
                              <vxe-table-column field="outcontroloperation" title="失控处理" width="100px" header-align="center"></vxe-table-column>
                              <vxe-table-column field="outcontrolresult" title="处理结果" width="100px" header-align="center"></vxe-table-column>
                              <vxe-table-column field="outcontroluser" title="处理人" width="100px" align="center"></vxe-table-column>
                              <vxe-table-column field="outcontroloperatedt" title="处理时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']" align="center"></vxe-table-column>
                              <vxe-table-column field="originalvalue" v-if="!hideinstrqcval" title="机器原始结果" width="100px" align="center"></vxe-table-column>
                              <vxe-table-column field="reagentmnfcturname" title="试剂厂商" width="150" header-align="center" sortable></vxe-table-column>
                              <vxe-table-column field="reagentbatchno" title="试剂批号" width="120" header-align="center" sortable></vxe-table-column>
                              <vxe-table-column field="calibratemnfcturname" title="校准品厂商" width="120" header-align="center" sortable v-if="!hideinstrqcval"></vxe-table-column>
                              <vxe-table-column field="calibrateno" title="校准品批号" width="120" header-align="center" sortable v-if="!hideinstrqcval"></vxe-table-column>
                              <vxe-table-column field="reagentvendorname" title="试剂供应商" width="120" header-align="center" sortable v-if="!hideinstrqcval"></vxe-table-column>
                              <vxe-table-column field="calibratevendorname" title="校准品供应商" width="120" header-align="center" sortable v-if="!hideinstrqcval"></vxe-table-column>
                              <vxe-table-column field="checkflag" title="审核标志" :formatter="['formatSelect', checkflagList]" width="80" align="center"></vxe-table-column>
                              <vxe-table-column field="checkuser" title="审核人" width="60" align="center"></vxe-table-column>
                              <vxe-table-column field="checkdt" title="审核时间" sortable width="80" :formatter="['toDateString', 'yyyy-MM-dd']" align="center"></vxe-table-column>
                              <vxe-table-column field="qcdataid" title="质控结果ID" sortable width="100px" align="center"></vxe-table-column>
                              <vxe-table-column field="qcid" title="质控品ID" sortable width="100px" align="center"></vxe-table-column>
                              <vxe-table-column field="instrid" title="仪器ID" width="100px" align="center"></vxe-table-column>
                              <vxe-table-column field="rpt_itemcode" title="报告项目CODE" sortable width="120px" align="center"></vxe-table-column>
                              <!-- <vxe-table-column   field="qcvaluesign"  title="结果标志"  width="100px"  header-align="center"  ></vxe-table-column>-->
                              <vxe-table-column field="qcitemvalueid" title="靶值标准ID" width="100px" align="center"></vxe-table-column>
                          </vxe-table>

                          <vxe-table v-else show-overflow ref="xTableAll" width="100%" height="auto" :loading="bAllSLoading" :select-config="{ reserve: true }" :data="tableDataAll" border size="mini" :keyboard-config="keyConfig" :mouse-config="{ selected: true }" show-header-overflow highlight-current-row highlight-hover-row resizable stripe :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }" :cell-class-name="getOutcontrolClassname">
                              <vxe-table-column type="selection" width="40" align="center"></vxe-table-column>
                              <vxe-table-column field="batchno" title="批号" width="80" header-align="center"></vxe-table-column>
                              <vxe-table-column field="rpt_itemcode" title="项目名称" sortable width="150px" :formatter="allDataFormatFun" header-align="center"></vxe-table-column>
                              <vxe-table-column field="qclevel" title="水平" width="50" align="center"></vxe-table-column>
                              <vxe-table-column field="qcdate" title="质控日期" width="80px" :formatter="['toDateString', 'yyyy-MM-dd']" align="center"></vxe-table-column>
                              <vxe-table-column field="qcvaluesign" title="结果标识" width="100px" header-align="center" align="right"></vxe-table-column>
                              <vxe-table-column field="resultdt" title="结果时间" width="160px" align="center">
                                  <template v-slot="{ row }">
                                      <el-date-picker v-model="row.resultdt" type="datetime" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss" :disabled="row.checkflag == '1'" @change="resultdtChange($event, row)"></el-date-picker>
                                  </template>
                              </vxe-table-column>
                              <!-- <vxe-table-column field="controlstatus" title="在控" :formatter="['formatSelect', controlstatusList]" width="80" align="center"></vxe-table-column> -->
                              <vxe-table-column field="controlstatusna" title="在控标志" width="130" align="center"></vxe-table-column>
                              <vxe-table-column field="inuseflag" title="累计" width="50" align="center">
                                  <template v-slot="{ row }">
                                      <el-checkbox v-model="row.inuseflag" true-label="1" false-label="0" :disabled="row.checkflag == '1'"></el-checkbox>
                                  </template>
                              </vxe-table-column>
                              <vxe-table-column field="drawflag" title="画图" width="50" align="center">
                                  <template v-slot="{ row }">
                                      <el-checkbox v-model="row.drawflag" true-label="1" false-label="0" :disabled="row.checkflag == '1'"></el-checkbox>
                                  </template>
                              </vxe-table-column>
                              <vxe-table-column field="displayvalue" title="显示结果" width="90" header-align="center" align="right" :edit-render="{ name: 'input', autoselect: true }">
                                  <template v-slot:edit="{ row }">
                                      <el-input v-model="row.displayvalue" style="height: 20px" :disabled="row.checkflag == '1'" @change="displaychange($event, row)">
                                      </el-input>
                                  </template>
                              </vxe-table-column>
                              <vxe-table-column field="calculatevalue" title="计算结果" width="80" header-align="center" align="right"></vxe-table-column>
                              <vxe-table-column field="modifyreason" title="修改原因" width="90" header-align="center" align="right" :edit-render="{ name: 'input', autoselect: true }">
                                  <template v-slot:edit="{ row }">
                                      <el-input v-model="row.modifyreason" style="height: 20px" :disabled="row.checkflag == '1'"></el-input>
                                  </template>
                              </vxe-table-column>
                              <vxe-table-column field="checkflag" title="审核" width="50" align="center">
                                  <template v-slot="{ row }">
                                      <el-checkbox v-model="row.checkflag" disabled true-label="1" false-label="0"></el-checkbox>
                                  </template>
                              </vxe-table-column>
                              <vxe-table-column field="begindt" title="靶值启用日期" width="100" :formatter="['toDateString', 'yyyy-MM-dd']" align="center"></vxe-table-column>
                              <vxe-table-column field="tagvalue" title="基准靶值" width="80" align="center"></vxe-table-column>
                              <vxe-table-column field="sd" title="基准SD" width="80" align="center"></vxe-table-column>
                              <vxe-table-column field="outcontroltips" title="失控提示" width="150" header-align="center"></vxe-table-column>
                              <vxe-table-column field="outcontrolreason" title="失控原因" width="150" header-align="center"></vxe-table-column>
                              <vxe-table-column field="outcontroloperation" title="失控处理" width="150" header-align="center"></vxe-table-column>
                              <vxe-table-column field="outcontrolresult" title="处理结果" width="150" header-align="center"></vxe-table-column>
                              <vxe-table-column field="cp_outcontroluser" title="处理人" width="60" header-align="center"></vxe-table-column>
                              <vxe-table-column field="outcontroloperatedt" title="处理时间" width="140" align="center"></vxe-table-column>
                              <vxe-table-column field="checkdt" title="审核时间" width="140" align="center"></vxe-table-column>
                              <vxe-table-column field="cp_checkuser" title="审核人" width="60" header-align="center"></vxe-table-column>
                              <vxe-table-column v-if="!hidelastuserndt" field="lastmodifydt" title="最后修改时间" width="140" align="center"></vxe-table-column>
                              <vxe-table-column v-if="!hidelastuserndt" field="cp_lastmodifyuser" title="最后修改人" width="100" header-align="center"></vxe-table-column>
                              <vxe-table-column field="comments" title="备注" width="100" header-align="center"></vxe-table-column>
                              <vxe-table-column field="originalvalue" v-if="!hideinstrqcval" title="机器原始结果" width="100" header-align="center"></vxe-table-column>
                              <vxe-table-column field="qcname" title="质控品名称" width="150" header-align="center"></vxe-table-column>
                              <!-- <vxe-table-column field="qcvaluesign" title="结果标识" width="100px" header-align="center"></vxe-table-column> -->
                              <vxe-table-column field="qcdataid" title="质控结果ID" width="100" header-align="center"></vxe-table-column>
                              <vxe-table-column field="qcitemvalueid" title="靶值标准ID" width="100" header-align="center"></vxe-table-column>
                              <vxe-table-column field="verifyflag" title="失控校验结果" width="100" header-align="center"> <template v-slot="{row}">
                                      {{row.verifyflag=="Y"?"合格":"不合格"}}
                                  </template></vxe-table-column>
                              <vxe-table-column field="qcid" title="质控品ID" width="100" header-align="center"></vxe-table-column>
                          </vxe-table>
                      </div>
                  </el-tab-pane>

                  <el-tab-pane label="质控评价">
                      <div align="right" style="width: 100%; padding: 0px 0px 5px 0px; height: 30px">
                          <el-button icon="el-icon-edit-outline" @click="addAppraise()">新增</el-button>
                          <el-button icon="el-icon-delete-solid" @click="deleteAppraise()">删除</el-button>
                          <el-button icon="el-icon-success" @click="saveAppraise(1)">提交</el-button>
                          <el-button icon="el-icon-success" @click="saveAppraise(2)">审核</el-button>
                          <el-button icon="el-icon-success" @click="saveAppraise(3)">解除审核</el-button>
                          <el-button icon="el-icon-success" @click="batchAppraise">当日未评价</el-button>
                      </div>
                      <div style="width: 100%; overflow: auto; top: 32px; position: absolute; bottom: 0px">
                          <vxe-table ref="xTableAppraise" width="100%" height="auto" :select-config="{ reserve: true }" :data.sync="tableAppraiseData" border size="mini" :keyboard-config="keyConfig" :mouse-config="{ selected: true }" show-header-overflow highlight-current-row highlight-hover-row resizable :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }" @current-change="AppraiseChange" :key="appraiseDataKey" :row-class-name="AppraiseRowClassName">
                              <!-- START -->
                              <vxe-table-column sortable title="审" width="20" show-overflow align="center">
                                  <template v-slot="{ row, rowIndex, columnIndex }">
                                      <div :key="'submit' + rowIndex + columnIndex" v-if="row.appraisetime != null && row.rechkdt == null">
                                          <font color="#000000">待</font>
                                      </div>
                                      <div :key="'rechk' + rowIndex + columnIndex" v-if="row.appraisetime != null && row.rechkdt != null">
                                          <font color="#000000">审</font>
                                      </div>
                                      <div :key="'new' + rowIndex + columnIndex" v-else></div>
                                  </template>
                              </vxe-table-column>
                              <vxe-table-column field="qcdate" title="评价日期" width="150px" :formatter="['toDateString', 'yyyy-MM-dd']" align="center">
                                  <template v-slot="{ row }">
                                      <el-date-picker v-model="row.qcdate" type="date" placeholder="选择日期" style="width: 100%" :disabled="row.appraiseuser != null"></el-date-picker>
                                  </template>
                              </vxe-table-column>
                              <vxe-table-column field="qcid" title="质控品" width="200" header-align="center" :edit-render="{ type: 'default' }">
                                  <template v-slot="{ row }">
                                      <el-select v-model="row.qcid" width="200" :disabled="row.appraiseuser != null">
                                          <el-option v-for="(item, index) in qcsOption" :key="index" :label="item.label" :value="item.value">{{ item.label }}</el-option>
                                      </el-select>
                                  </template>
                              </vxe-table-column>
                              <vxe-table-column field="appraisetext" title="评价内容" width="280px" header-align="center" :edit-render="{ name: 'input' }">
                                  <template v-slot:edit="{ row }">
                                      <el-input v-model="row.appraisetext" @dblclick.native="row.appraiseuser == null ? ShowAdvice(5, row) : ''" :disabled="row.appraiseuser != null"></el-input>
                                  </template>
                              </vxe-table-column>
                              <vxe-table-column field="appraisetime" title="操作时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']" align="center"></vxe-table-column>
                              <vxe-table-column field="appraiseusername" title="操作人" width="100px" align="center"></vxe-table-column>
                              <vxe-table-column field="rechktext" title="审核意见" width="280px" header-align="center" :edit-render="{ name: 'input' }">
                                  <!-- :edit-render="{ name: 'input' }" -->
                                  <template v-slot:edit="{ row }">
                                      <el-input v-if="row.appraiseuser != null" v-model="row.rechktext" @dblclick.native="row.rechkuser == null ? ShowAdvice(6, row) : ''"></el-input>
                                      <el-input v-else v-model="row.rechktext" :disabled="true"></el-input>
                                  </template>
                              </vxe-table-column>
                              <vxe-table-column field="rechkdt" title="审核时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']" align="center"></vxe-table-column>
                              <vxe-table-column field="rechkusername" title="审核人" width="100px" align="center"></vxe-table-column>
                          </vxe-table>
                          <!-- END -->
                      </div>
                  </el-tab-pane>
              </el-tabs>
          </div>
      </div>

      <el-dialog width="1100px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="'质控签名：' + instrName+'   当前用户：'+qcsignusername" :visible.sync="qcsignDialogVisible">
          <div style="width: 100%; padding: 0px 0px 5px 0px">
              <table>
                  <tr>
                      <td width="10px">日期</td>
                      <td>
                          <el-date-picker v-model="qcsignDate[0]" type="date" placeholder="开始日期" value-format="yyyy-MM-dd" style="width: 130px" :clearable="false" @change="getQcsignData"></el-date-picker> ~
                          <el-date-picker v-model="qcsignDate[1]" type="date" placeholder="结束日期" value-format="yyyy-MM-dd" style="width: 130px" :clearable="false" @change="getQcsignData"></el-date-picker>
                      </td>
                      <td width="60px">质控项目</td>
                      <td>
                          <el-select v-model="qcsignRptitemcode" placeholder="请选择" clearable @change="getQcsignData">
                              <el-option v-for="(item, index) in qcsignRptitemcodes" :key="index" :label="item.label" :value="item.value" :disabled="item.disabled"></el-option>
                          </el-select>
                      </td>
                      <td width="40px">批号</td>
                      <td align="right">
                          <el-select v-model="qcsignBatchno" placeholder="请选择" clearable @change="getQcsignData">
                              <el-option v-for="(item, index) in qcsignBatchnos" :key="index" :label="item.label" :value="item.value" :disabled="item.disabled"></el-option>
                          </el-select>
                      </td>
                      <td>
                          <el-radio-group v-model="qcsignChecked" size="mini" @change="getQcsignData">
                              <!-- @change="a" -->
                              <el-radio-button label="all">全部</el-radio-button>
                              <el-radio-button label="0">未审核</el-radio-button>
                              <el-radio-button label="1">已审核</el-radio-button>
                          </el-radio-group>
                      </td>
                  </tr>
              </table>
          </div>

          <vxe-table show-overflow ref="xTableQcsign" width="100%" height="400px" border :select-config="{ checkAll: false, checkMethod}" :data.sync="tableDataQcsign" size="mini" :keyboard-config="keyConfig" :mouse-config="{ selected: true }" show-header-overflow highlight-current-row highlight-hover-row resizable stripe :cell-class-name="getOutcontrolClassname" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }">
              <vxe-table-column type="selection" width="40px" align="center"></vxe-table-column>
              <vxe-table-column field="rpt_itemname" title="项目名称" width="150px" header-align="center"></vxe-table-column>
              <vxe-table-column field="checkflag" title="审核标志" :formatter="['formatSelect', checkflagList]" width="80" align="center"></vxe-table-column>
              <vxe-table-column field="checkuser" title="审核人" width="60" align="center"></vxe-table-column>
              <vxe-table-column field="checkdt" title="审核时间" width="100" :formatter="['toDateString', 'yyyy-MM-dd']" align="center"></vxe-table-column>
              <vxe-table-column field="qcdate" title="日期" width="100px" :formatter="['toDateString', 'yyyy-MM-dd']" align="center"></vxe-table-column>
              <vxe-table-column field="controlstatus" title="在控标志" width="120px" :formatter="['formatSelect', controlstatusList]" align="center"></vxe-table-column>
              <!-- <vxe-table-column field="controlstatusna" title="在控标志" width="80px" align="center"></vxe-table-column> -->
              <vxe-table-column field="qclevel" title="水平" width="60px" align="center"></vxe-table-column>
              <vxe-table-column field="resultdt" title="结果时间" width="140px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']" header-align="center"></vxe-table-column>
              <vxe-table-column field="displayvalue" title="显示结果" width="100px" header-align="center"></vxe-table-column>
              <vxe-table-column field="calculatevalue" title="计算结果" width="80px" header-align="center" align="right"></vxe-table-column>
              <vxe-table-column field="calculatesd" title="计算的SD" width="80px" :formatter="['toFixedString', 4]" header-align="center" align="right"></vxe-table-column>
              <vxe-table-column field="cp_calculatecv" title="计算的CV" width="80px" :formatter="['toFixedString', 4]" header-align="center" align="right"></vxe-table-column>
              <vxe-table-column field="inuseflag" title="累计" width="60px" align="center" :formatter="['formatSelect', dgList]"></vxe-table-column>
              <vxe-table-column field="drawflag" title="画图" width="60px" align="center" :formatter="['formatSelect', dgList]"></vxe-table-column>
              <!-- <vxe-table-column field="inuseflagna" title="累计" width="60px" align="center"></vxe-table-column>
              <vxe-table-column field="drawflagna" title="画图" width="60px" align="center"></vxe-table-column> -->
              <vxe-table-column field="outcontroltips" title="失控提示" width="100px" header-align="center"></vxe-table-column>
              <vxe-table-column field="tagvalue" title="靶值" width="100px" header-align="center" align="right"></vxe-table-column>
              <vxe-table-column field="sd" title="SD" width="100px" header-align="center" align="right"></vxe-table-column>
              <vxe-table-column field="cv" title="CV" width="100px" header-align="center" align="right"></vxe-table-column>
              <vxe-table-column field="outcontrolreason" title="失控原因" width="100px" header-align="center"></vxe-table-column>
              <vxe-table-column field="outcontroloperation" title="失控处理" width="100px" header-align="center"></vxe-table-column>
              <vxe-table-column field="outcontrolresult" title="处理结果" width="100px" header-align="center"></vxe-table-column>
              <vxe-table-column field="outcontroluser" title="处理人" width="100px" header-align="center"></vxe-table-column>
              <vxe-table-column field="batchno" title=" 批号" width="100px" align="center"></vxe-table-column>
              <vxe-table-column field="outcontroloperatedt" title="处理时间" width="100px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']" header-align="center"></vxe-table-column>
              <vxe-table-column field="originalvalue" v-if="!hideinstrqcval" title="机器原始结果" width="100px" header-align="center"></vxe-table-column>
              <vxe-table-column field="qcdataid" title="质控结果ID" width="100px" header-align="center"></vxe-table-column>
              <vxe-table-column field="qcid" title="质控品ID" width="100px" header-align="center"></vxe-table-column>
              <vxe-table-column field="instrid" title="仪器ID" width="100px" header-align="center"></vxe-table-column>
              <vxe-table-column field="rpt_itemcode" title="报告项目CODE" width="120px" header-align="center"></vxe-table-column>

              <vxe-table-column field="qcitemvalueid" title="靶值标准ID" width="100px" header-align="center"></vxe-table-column>
          </vxe-table>

          <span slot="footer" class="dialog-footer">
              <el-button style="margin: 0px 10px 0px 5px" icon="el-icon-search" @click="qcsignRefresh_click()">查询</el-button>
              <el-button style="margin: 0px 10px 0px 5px" icon="el-icon-success" @click="qcsignCheck_click()">签名</el-button>
              <el-button style="margin: 0px 10px 0px 5px" icon="el-icon-success" @click="qcsignUnCheck_click()">取消签名</el-button>
              <el-button style="margin: 0px 10px 0px 5px" icon="el-icon-close" @click="qcsignExit_click()">退出</el-button>
          </span>
      </el-dialog>
      <el-dialog width="600px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="修改结果" :visible.sync="Valuedialogvisible">
          <table>
              <tr>
                  <td style="text-align: right">质控日期</td>
                  <td>
                      <el-input v-model="tempqcdata.qcdate" disabled></el-input>
                  </td>
                  <td style="text-align: right">结果时间</td>
                  <td colspan="3">
                      <el-input v-model="tempqcdata.resultdt" disabled></el-input>
                  </td>
              </tr>
              <tr>
                  <td style="text-align: right">靶值</td>
                  <td>
                      <el-input v-model="tempqcdata.tagvalue" disabled></el-input>
                  </td>
                  <td style="text-align: right">SD</td>
                  <td>
                      <el-input v-model="tempqcdata.sd" disabled></el-input>
                  </td>
                  <td style="text-align: right">CV</td>
                  <td>
                      <el-input v-model="tempqcdata.cv" disabled></el-input>
                  </td>
              </tr>
              <tr>
                  <td style="text-align: right">上限</td>
                  <td>
                      <el-input v-model="tempqcdata.limithigh" disabled></el-input>
                  </td>
                  <td style="text-align: right">下限</td>
                  <td>
                      <el-input v-model="tempqcdata.limitlow" disabled></el-input>
                  </td>
              </tr>
              <tr>
                  <td style="text-align: right">在控标志</td>
                  <td>
                      <el-input v-model="tempqcdata.controlstatus" disabled></el-input>
                  </td>
                  <td style="text-align: right">累计标志</td>
                  <td>
                      <el-checkbox v-model="tempqcdata.inuseflag" true-label="1" false-label="0"></el-checkbox>
                  </td>
                  <td style="text-align: right">画图标志</td>
                  <td>
                      <el-checkbox v-model="tempqcdata.drawflag" true-label="1" false-label="0"></el-checkbox>
                  </td>
              </tr>
              <tr>
                  <td style="text-align: right">显示结果</td>
                  <td>
                      <el-input v-model="tempqcdata.displayvalue" disabled></el-input>
                  </td>
                  <td style="text-align: right">计算结果</td>
                  <td>
                      <el-input v-model="tempqcdata.calculatevalue" disabled></el-input>
                  </td>
                  <td style="text-align: right">SD值</td>
                  <td>
                      <el-input v-model="tempqcdata.calculatesd" disabled></el-input>
                  </td>
              </tr>
              <tr>
                  <td style="text-align: right">修改值</td>
                  <td>
                      <el-input v-model="qcupdatevalue" @change="Calcnew"></el-input>
                  </td>
                  <td style="text-align: right">新计算结果</td>
                  <td>
                      <el-input v-model="qccalupdatevalue" disabled></el-input>
                  </td>
                  <td style="text-align: right">新SD值</td>
                  <td>
                      <el-input v-model="qccalupdatesd" disabled></el-input>
                  </td>
              </tr>
              <tr>
                  <td style="text-align: right">修改原因</td>
                  <td colspan="5">
                      <el-input v-model="updatereason" type="textarea" :rows="3"></el-input>
                  </td>
              </tr>
          </table>
          <span slot="footer" class="dialog-footer">
              <el-button style="margin: 0px 10px 0px 5px" @click="CalculateSave()">确定</el-button>
              <el-button style="margin: 0px 10px 0px 5px" @click="(Valuedialogvisible = false), (tempqcdata = {})">取消</el-button>
          </span>
      </el-dialog>
      <el-dialog width="900px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="'失控处理   当前处理人：'+qcoutcontrolusername" :visible.sync="outofcontrolvisible">
          <table>
              <tr>
                  <td style="text-align: right">质控日期</td>
                  <td>
                      <el-input v-model="tempqcdata.qcdate" disabled></el-input>
                  </td>
                  <td style="text-align: right">结果时间</td>
                  <td>
                      <el-input v-model="tempqcdata.resultdt" disabled></el-input>
                  </td>
                  <td style="text-align: right">计算结果</td>
                  <td>
                      <el-input v-model="tempqcdata.calculatevalue" disabled></el-input>
                  </td>
                  <td style="text-align: right">SD值</td>
                  <td>
                      <el-input v-model="tempqcdata.calculatesd" disabled></el-input>
                  </td>
              </tr>
              <tr>
                  <td style="text-align: right">靶值</td>
                  <td>
                      <el-input v-model="qcitem.tagvalue" disabled></el-input>
                  </td>
                  <td style="text-align: right">SD</td>
                  <td>
                      <el-input v-model="qcitem.sd" disabled></el-input>
                  </td>
                  <td style="text-align: right">CV</td>
                  <td>
                      <el-input v-model="qcitem.cv" disabled></el-input>
                  </td>
                  <td style="text-align: right">上限</td>
                  <td>
                      <el-input v-model="qcitem.limithigh" disabled></el-input>
                  </td>
                  <td style="text-align: right">下限</td>
                  <td>
                      <el-input v-model="qcitem.limitlow" disabled></el-input>
                  </td>
              </tr>
              <tr>
                  <td style="text-align: right">在控标志</td>
                  <td>
                      <el-input v-model="tempqcdata.controlstatus" disabled></el-input>
                  </td>
                  <td style="text-align: right">失控提示</td>
                  <td>
                      <el-input v-model="tempqcdata.outcontroltips" disabled></el-input>
                  </td>
              </tr>
              <tr>
                  <td>
                      <span style="color: blue">失控原因</span>
                  </td>
                  <td colspan="9">
                      <el-input v-model="tempqcdata.outcontrolreason" type="textarea" :rows="3" @dblclick.native="ShowAdvice(0)"></el-input>
                  </td>
              </tr>
              <tr>
                  <td>
                      <span style="color: blue">失控处理</span>
                  </td>
                  <td colspan="9">
                      <el-input v-model="tempqcdata.outcontroloperation" type="textarea" :rows="3" @dblclick.native="ShowAdvice(1)"></el-input>
                  </td>
              </tr>
              <tr>
                  <td>
                      <span style="color: blue">处理结果</span>
                  </td>
                  <td colspan="9">
                      <el-input v-model="tempqcdata.outcontrolresult" type="textarea" :rows="3" @dblclick.native="ShowAdvice(2)"></el-input>
                  </td>
              </tr>
              <tr>
                  <td>
                      <span style="color: blue">修正结果</span>
                  </td>
                  <td colspan="3">
                      <el-input v-model="tempqcdata.outtransokresult"></el-input>
                  </td>
                  <td>处理人</td>
                  <td>
                      <el-input v-model="tempqcdata.outcontroluser" disabled></el-input>
                  </td>
                  <td>处理时间</td>
                  <td>
                      <el-input v-model="tempqcdata.outcontroloperatedt" disabled></el-input>
                  </td>
              </tr>
              <tr>
                  <!-- <td>
                      <el-checkbox v-model="showallbatch" size="mini" true-label="1" false-label="0" @change="queryDate_change"></el-checkbox>
                  </td> -->
                  <!-- <td>失控修正验证</td>
                  <td>验证结果</td>
              <td>     <el-input style="print" v-model="row.lineBatch" autosize readonly></el-input></td> -->
                  <td>失控修正验证</td>
                  <td>
                      <el-input style="print" v-model="tempqcdata.verifyflag" @click.native="OpenVerify" readonly></el-input>
                  </td>
              </tr>
              <tr>
                  <td>临床影响</td>
                  <td colspan="9">
                      <el-input v-model="tempqcdata.cliniceffect" type="textarea" :rows="3" @dblclick.native="ShowAdvice(3)"></el-input>
                  </td>
              </tr>
              <tr>
                  <td>预防措施</td>
                  <td colspan="9">
                      <el-input v-model="tempqcdata.premunition" type="textarea" :rows="3" @dblclick.native="ShowAdvice(4)"></el-input>
                  </td>
              </tr>
              <tr>
                  <td>备注</td>
                  <td colspan="9">
                      <el-input v-model="tempqcdata.comments" type="textarea" :rows="3" @dblclick.native="ShowAdvice(7)"></el-input>
                  </td>
              </tr>
          </table>
          <span slot="footer" class="dialog-footer">
              <el-button style="margin:0px 10px 0px 5px" @click="CopyOutControl()">应用到其他失控点</el-button>
              <el-button style="margin: 0px 10px 0px 5px" @click="OutControlSave()">确定</el-button>
              <el-button style="margin: 0px 10px 0px 5px" @click="(outofcontrolvisible = false), (tempqcdata = {})">取消</el-button>
          </span>
      </el-dialog>
      <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :visible.sync="dialogAdviceVisible" title="报告单元文字描述结果选择" :destroy-on-close="true" top="5vh" width="600px">
          <div>
              <table style="width: 100%; border-spacing: 0px; margin-top: 5px">
                  <tr>
                      <td>
                          <div>
                              <el-input type="textarea" :rows="12" v-model="advicetxt"></el-input>
                          </div>
                      </td>
                      <td>
                          <div style="margin-left: 15px">
                              <el-button style="display: block" @click="AdviceSubmit()">确 定</el-button>
                              <el-button style="display: block; margin-left: 0px; margin-top: 5px" @click="dialogAdviceVisible = false">取 消</el-button>
                              <el-checkbox v-model="appendChangeRow" style="margin-top: 20px; display: block">追加时自动换行</el-checkbox>
                              <div style="margin-top: 20px">
                                  <span style="color: blue">说明:<br />单击为追加<br />双击为替换</span>
                              </div>
                          </div>
                      </td>
                  </tr>
                  <tr>
                      <td style="width: 450px">
                          <vxe-table :data="tableDataAdvice" :loading="loadingAdvice" @cell-click="AdviceClick" @cell-dblclick="AdvicedblClick" height="300px" highlight-current-row highlight-hover-row resizable highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" size="mini" stripe width="400px">
                              <vxe-table-column field="txtinfo" title="文字描述" width="160px"></vxe-table-column>
                              <vxe-table-column field="seq" title="序号" width="80px"></vxe-table-column>
                              <vxe-table-column field="inputcode" title="输入码" width="80px"></vxe-table-column>
                          </vxe-table>
                      </td>
                      <td style="text-align: center">
                          <vxe-table :data="txtinfoarr" @current-change="infochange" height="300px" highlight-current-row highlight-hover-row resizable highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" size="mini" stripe ref="txtinfokind">
                              <vxe-table-column field="txtinfokind" title="描述归类" width="160px"></vxe-table-column>
                          </vxe-table>
                      </td>
                  </tr>
              </table>
          </div>
      </el-dialog>
      <!-- 以下为打印弹窗窗口 -->
      <el-dialog width="900px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="打印预览" :visible.sync="printDialogvisible">
          <el-button icon="el-icon-printer" @click="qcPrintReport_click()">打印</el-button>
          <div ref="printqcReport" id="printqcReport">
              <table width="100%">
                  <tr>
                      <td style="text-align: center; font-size: 18px">
                          {{ hospitalname + "      质控图" }}
                      </td>
                  </tr>
                  <tr>
                      <td>
                          <hr width="100%" />
                      </td>
                  </tr>
                  <tr>
                      <td style="text-align: left; font-size: 14px">仪器：{{ instrName }}&emsp;&emsp;&emsp;&emsp;日期区间：{{ queryDate[0] }}&emsp;~&emsp;{{ queryDate[1] }}&emsp;&emsp;&emsp;&emsp;{{ printQcFilecode }}&emsp;&emsp;{{this.testmethod}}</td>
                  </tr>
              </table>
              <img style="text-align: left" v-bind:src="echartImg" height="auto" width="98%" />
              <div class="showPrintQcdataClass">
                  <table v-if="qcOption.SHOWREAGENT=='1'" class="Printtable">
                      <tr style="background: #eee; text-align: center; font-weight: bold">
                          <td width="30px" style="text-align: center">水平</td>
                          <td width="70px" style="text-align: center">批号</td>
                          <td width="80px" style="text-align: center">名称</td>
                          <td width="60px" style="text-align: center">靶值/均值</td>
                          <td width="60px" style="text-align: center">标准差</td>
                          <td width="60px" style="text-align: center">变异系数</td>
                          <td width="70px" style="text-align: center">有效期</td>
                          <td width="30px" style="text-align: center">数量</td>
                          <td width="140px" style="text-align: center">备注</td>
                          <td width="70px" style="text-align: center">试剂厂商</td>
                          <td width="70px" style="text-align: center">试剂批号</td>
                          <td width="80px" style="text-align: center">校准品厂商</td>
                          <td width="80px" style="text-align: center">校准品批号</td>
                      </tr>
                      <tr v-for="(item, index) in tableDataLines" :key="index">
                          <td style="text-align: center">{{ item.lineLevel }}</td>
                          <td style="text-align: left">{{ item.lineBatch }}</td>
                          <td style="text-align: left">{{ item.lineName }}</td>
                          <td style="text-align: right">{{ item.lineTagvalue }}</td>
                          <td style="text-align: right">{{ item.lineSd }}</td>
                          <td style="text-align: right">{{ item.lineCv }}</td>
                          <td style="text-align: center">{{ item.lineExpriedt }}</td>
                          <td style="text-align: right">{{ item.lineNum }}</td>
                          <td style="text-align: left">{{ item.lineComm }}</td>
                          <td style="text-align: left">{{ item.linereagentmnfcturname}}</td>
                          <td style="text-align: left">{{ item.linereagentbatchno}}</td>
                          <td style="text-align: left">{{ item.linecalibratemnfcturname }}</td>
                          <td style="text-align: left">{{ item.linecalibrateno }}</td>
                      </tr>
                  </table>
                  <table v-else class="Printtable">
                      <tr style="background: #eee; text-align: center; font-weight: bold">
                          <td width="50px" style="text-align: center">水平</td>
                          <td width="115px" style="text-align: center">批号</td>
                          <td width="115px" style="text-align: center">名称</td>
                          <td width="80px" style="text-align: center">靶值/均值</td>
                          <td width="70px" style="text-align: center">标准差</td>
                          <td width="70px" style="text-align: center">变异系数</td>
                          <td width="85px" style="text-align: center">有效期</td>
                          <td width="50px" style="text-align: center">数量</td>
                          <td width="153px" style="text-align: center">备注</td>
                      </tr>
                      <tr v-for="(item, index) in tableDataLines" :key="index">
                          <td style="text-align: center">{{ item.lineLevel }}</td>
                          <td style="text-align: left">{{ item.lineBatch }}</td>
                          <td style="text-align: left">{{ item.lineName }}</td>
                          <td style="text-align: right">{{ item.lineTagvalue }}</td>
                          <td style="text-align: right">{{ item.lineSd }}</td>
                          <td style="text-align: right">{{ item.lineCv }}</td>
                          <td style="text-align: center">{{ item.lineExpriedt }}</td>
                          <td style="text-align: right">{{ item.lineNum }}</td>
                          <td style="text-align: left">{{ item.lineComm }}</td>
                      </tr>
                  </table>
              </div>
              <br />
              <div class="showPrintQcdataClass">
                  <table style="width: 100%; height: 100%" class="Printtable">
                      <tr v-for="(item, index) in tableDataPrintQcdata" :key="index" :style="{ background: item.rowname == '日期' ? '#eee' : 'white', fontWeight: item.rowname == '日期' ? 'bold' : 'normal' }">
                          <td style="text-align: center">{{ item.rowname }}</td>
                          <td :style="{ textAlign: item.rowname == '日期' ? 'center' : 'right' }" v-for="level in printQcdataLen" :key="level">{{ item[printQcdataDate[level - 1]] }}</td>
                      </tr>
                  </table>
              </div>
              <br />
              <div class="showPrintQcdataClass">
                  <table class="Printtable">
                      <tr style="background: #eee; text-align: center; font-weight: bold">
                          <td width="90px" style="text-align: center">日期</td>
                          <td width="50px" style="text-align: center">水平</td>
                          <td width="100px" style="text-align: center">失控规则</td>
                          <td width="150px" style="text-align: center">失控原因</td>
                          <td width="150px" style="text-align: center">失控处理</td>
                          <td width="120px" style="text-align: center">处理结果</td>
                          <td width="60px" style="text-align: center">处理人</td>
                          <td width="100px" style="text-align: center">处理日期</td>
                      </tr>
                      <tr v-for="(item, index) in tableDataOutcontrol" :key="index">
                          <td>{{ item.qcdate }}</td>
                          <td style="text-align: center">{{ item.qclevel }}</td>
                          <td style="text-align: left">{{ item.outcontroltips }}</td>
                          <td style="text-align: left">{{ item.outcontrolreason }}</td>
                          <td style="text-align: left">{{ item.outcontroloperation }}</td>
                          <td style="text-align: left">{{ item.outcontrolresult }}</td>
                          <td style="text-align: center">{{ item.outcontroluser }}</td>
                          <td style="text-align: center">{{ item.outcontroloperatedt }}</td>
                      </tr>
                  </table>
              </div>
              <br />
              <div class="showPrintQcdataClass" style="width: 100%">
                  <!-- <vxe-table :data="tableAppraiseData" height="auto" resizable border show-header-overflow="tooltip" :show-overflow="false" header-align="center" size="mini" stripe width="100%">
                      <vxe-table-column field="qcdate" title="评价日期" width="100px"></vxe-table-column>
                      <vxe-table-column field="qcname" title="质控品" width="120px"></vxe-table-column>
                      <vxe-table-column field="appraisetext" title="评价内容" width="338px"></vxe-table-column>
                      <vxe-table-column field="appraisetime" title="操作时间" width="140px"></vxe-table-column>
                      <vxe-table-column field="appraiseuser" title="操作人" width="150px"></vxe-table-column>
                  </vxe-table> -->
                  <table v-if="qcOption.HIDEAPPRAISE!='1'" class="Printtable" style="table-layout: fixed; width: 100%">
                      <tr style="background: #eee; text-align: center; font-weight: bold">
                          <td width="120px" style="text-align: center">评价日期</td>
                          <td width="120px" style="text-align: center">质控品</td>
                          <td width="338px" style="text-align: center">评价内容</td>
                          <td width="140px" style="text-align: center">操作时间</td>
                          <td width="130px" style="text-align: center">操作人</td>
                      </tr>
                      <tr v-for="(item, index) in tableAppraiseData" :key="index">
                          <td width="120px" style="text-align: center">{{ item.qcdate }}</td>
                          <td width="120px" style="text-align: center">{{ item.qcname }}</td>
                          <td width="338px">
                              <div style="text-align: left; word-break: break-word; width: 337px; white-space: normal">
                                  {{ item.appraisetext }}
                              </div>
                          </td>
                          <td width="140px" style="text-align: center">{{ item.appraisetime }}</td>
                          <td width="130px" style="text-align: left">{{ item.appraiseusername }}</td>
                      </tr>
                  </table>
              </div>
              <br />
              <table width="100%">
                  <tr>
                      <td colspan="3">
                          <hr width="100%" />
                      </td>
                  </tr>
                  <tr>
                      <td width="33%" style="text-align: left; font-size: 14px; fontweight: 700">{{ printQcFooter[0] }}</td>
                      <td width="33%" style="text-align: left; font-size: 14px; fontweight: 700">{{ printQcFooter[1] }}</td>
                      <td width="33%" style="text-align: left; font-size: 14px; fontweight: 700">{{ printQcFooter[2] }}</td>
                  </tr>
              </table>
          </div>
      </el-dialog>
      <rm-floatwindow v-rm-drag-window :visible="bShowUndecidedReson" winStyle="top:150px;left:70px;width:580px;height:480px;" :title="floatwinna">
          <div style="width:100%;height:calc(100% - 350px);overflow:auto;">
              <div style="font-size: 14px;
  font-weight: 900;
  color: red;">当前存在{{floatwincnt}}条质控数据未判定，请予以关注。</div>
              <div v-for="msg in floatwinlist" :key="msg.seq" style="over-flow:auto;font-size: 12.5px;">
                  <td style="width:30px;padding-left:5px">{{msg.seq}}.</td>
                  <td style="width:140px">{{msg.errotype}}</td>
                  <td>{{msg.erromsg}}</td>
              </div>
          </div>
          <div style="width:100%;top:55px;">
              <el-collapse v-model="activeNames">
                  <el-collapse-item title="常见问题解决方案" name="1">
                      <div>1.批号选择不分批号，质控日期向前拉长，在所有数据中诊断。</div>
                      <div>原因:质控判定点是连续的，如果计算数据的上一点没有判定，下一点是无法判定的。拉长质控日期可以将之前存在的未判定点判定，结合所有数据诊断，大部分未判定的问题就解决了。</div>
                      <div>2.Westgard判定：请您检查质控品及质控品项目靶值，确保质控点判定都存在有效的靶值标准依据。</div>
                      <div>3.Westgard判定：请检查质控规则是否是Westgard规则，确保质控点判定都存在有效的质控规则提供支持。</div>
                  </el-collapse-item>
                  <el-collapse-item title="无靶值数据" name="2">
                      <div>请您检查质控品及质控品项目靶值，确保质控点判定都有可取得的靶值依据。</div>
                  </el-collapse-item>
                  <el-collapse-item title="无质控规则" name="3">
                      <div>请您检查当前仪器/项目在用的质控规则，确保质控点判定时有质控规则支持。</div>
                  </el-collapse-item>
                  <el-collapse-item title="Westgard规则判断失败" name="4">
                      <div>不是WestGuard规则：请检查您的质控规则设置，是否是Westgard规则；</div>
                      <div>用于计算的数据里有部份没有靶值标准：质控判定需要通过当前点及当前点之前参与计算的点判定，提示本信息，修正之前点的未判定，该点即可判定；</div>
                  </el-collapse-item>
              </el-collapse>
          </div>
      </rm-floatwindow>
      <el-dialog width="730px" height="500px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="批次审查" :visible.sync="bListQcCalc">
          <div v-if="bClassLoading" style="height:100%;width:100%;position: absolute;z-index:9999;">
              <div style="padding-top:100px;width:100%;">
                  <div style="opacity:1;padding: top 100px;" class="loading">
                      <div><span></span></div>
                      <div><span></span></div>
                      <div><span></span></div>
                  </div>
                  <div style="padding-top:25px;text-align:center;font-family:'microsoft yahei';color:black;font-size:15px;font-weight: 500">
                      {{loadingtxt}}</div>
              </div>
          </div>
          <div v-if="bClassLoading" style="height:100%;width:100%;position: absolute;z-index:9998;opacity:0.7;background-color:white">
          </div>
          <div style="margin-top: 1px; height: 100%; width: 100%" class="Listclass">
              <vxe-table :data.sync="listLogData" :select-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="400px" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="rpt2ndTable" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{animat: false}" header-align="center" :key="listqccalckey" :span-method="colspanMethod" :row-class-name="ResultRowName" :tree-config="{children: 'children', expandAll: true, trigger: 'row'}" :show-header="false">
                  <vxe-table-column field="seq" sortable title="序号" width="40" show-overflow></vxe-table-column>
                  <vxe-table-column field="errotype" align="center" sortable title="类型" width="200" show-overflow></vxe-table-column>
                  <vxe-table-column field="erromsg" align="center" sortable title="信息" width="450" show-overflow></vxe-table-column>
                  <template v-slot:fix>
                      <div style="font-size:12px;float:top;padding-top:3px;background-color:#fff;">
                          <el-progress :text-inside="true" :stroke-width="15" :percentage=percentage status="success"></el-progress>
                      </div>
                      <div style="clear:both"></div>
                  </template>
              </vxe-table>
          </div>
      </el-dialog>
      <el-dialog width="730px" height="500px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="重新设置待判定标本" :visible.sync="bListSetNull">
          <div v-if="bClassLoading" style="height:100%;width:100%;position: absolute;z-index:9999;">
              <div style="padding-top:100px;width:100%;">
                  <div style="opacity:1;padding: top 100px;" class="loading">
                      <div><span></span></div>
                      <div><span></span></div>
                      <div><span></span></div>
                  </div>
                  <div style="padding-top:25px;text-align:center;font-family:'microsoft yahei';color:black;font-size:15px;font-weight: 500">
                      {{setnullloadingtxt}}</div>
              </div>
          </div>
          <div v-if="bClassLoading" style="height:100%;width:100%;position: absolute;z-index:9998;opacity:0.7;background-color:white">
          </div>
          <div style="margin-top: 1px; height: 100%; width: 100%" class="Listclass">
              <vxe-table :data.sync="listNullLogData" :select-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="400px" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="setNullTable" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{animat: false}" header-align="center" :key="listqccalckey" :span-method="colspanMethod" :row-class-name="ResultRowName" :tree-config="{children: 'children', expandAll: true, trigger: 'row'}" :show-header="false">
                  <vxe-table-column field="seq" sortable title="序号" width="40" show-overflow></vxe-table-column>
                  <vxe-table-column field="errotype" align="center" sortable title="类型" width="200" show-overflow></vxe-table-column>
                  <vxe-table-column field="erromsg" align="center" sortable title="信息" width="450" show-overflow></vxe-table-column>
                  <template v-slot:fix>
                      <div style="font-size:12px;float:top;padding-top:3px;background-color:#fff;">
                          <el-progress :text-inside="true" :stroke-width="15" :percentage=percentagenull status="success"></el-progress>
                      </div>
                      <div style="clear:both">
                      </div>
                  </template>
              </vxe-table>
          </div>
          <div style="float: right;">
              <el-button style="margin: 0px 0px 0px 0px" @click="qccalc()" v-has="'PINQUERY'">判定待判定的标本</el-button>&nbsp;
              <el-button style="margin: 0px 0px 0px 0px" @click="bListSetNull=false" v-has="'PINQUERY'">关闭</el-button>
          </div>
      </el-dialog>
      <el-dialog width="730px" height="500px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="当日质控相关项目处理" :visible.sync="bCopyOutControl">
          <div>
              <el-checkbox v-model="sBatchOtherLv" @change="queryCopyOutControl" true-label="1" false-label="0">显示同批号其他水平数据</el-checkbox>
              <el-checkbox v-model="passHandle" @change="queryCopyOutControl" true-label="1" false-label="0">过滤已处理过的记录</el-checkbox>
          </div>
          <div style="margin-top: 1px; height: 100%; width: 100%">
              <vxe-table :data.sync="copyOutControlData" :select-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="400px" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="copyOutControlTable" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{animat: false}" header-align="center" :key="listqccalckey" :span-method="colspanMethod" :row-class-name="ResultRowName" :tree-config="{children: 'children', expandAll: true, trigger: 'row'}">
                  <!-- <vxe-table-column :key="item.field" :field="item.field" :title="item.title" v-for="item in tableColumn" align="center" :width="item.width" sortable :sort-width="item.field=='sampleno'?20:0"></vxe-table-column> -->
                  <vxe-table-column type="selection" width="40" align="center"></vxe-table-column>
                  <vxe-table-column field="controlstatusna" title="在控" width="80" align="center"></vxe-table-column>
                  <vxe-table-column field="qcdate" title="质控日期" width="80px" :formatter="['toDateString', 'yyyy-MM-dd']" align="center"></vxe-table-column>
                  <vxe-table-column field="rpt_itemname" title="报告项目" width="60px" align="center"></vxe-table-column>
                  <vxe-table-column field="qclevel" title="水平" width="60px" align="center"></vxe-table-column>
                  <vxe-table-column field="outcontrolreason" title="失控原因" width="100px" header-align="center"></vxe-table-column>
                  <vxe-table-column field="outcontroloperation" title="失控处理" width="100px" header-align="center"></vxe-table-column>
                  <vxe-table-column field="outcontrolresult" title="处理结果" width="100px" header-align="center"></vxe-table-column>
                  <vxe-table-column field="outcontroluser" title="处理人" width="100px" header-align="center"></vxe-table-column>
                  <vxe-table-column field="outtransokresult" title="修正结果" width="100px" header-align="center"></vxe-table-column>
                  <vxe-table-column field="outcontroloperatedt" title="处理时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']" align="center"></vxe-table-column>
                  <vxe-table-column field="cliniceffect" title="临床影响" width="100px" header-align="center"></vxe-table-column>
                  <vxe-table-column field="premunition" title="预防措施" width="100px" header-align="center"></vxe-table-column>
                  <vxe-table-column field="comments" title="备注" width="100px" header-align="center"></vxe-table-column>
                  <vxe-table-column field="qcdataid" title="质控结果ID" width="100" header-align="center"></vxe-table-column>
                  <vxe-table-column field="originalvalue" title="机器原始结果" width="100" header-align="center"></vxe-table-column>
                  <vxe-table-column field="qcname" title="质控品名称" width="150" header-align="center"></vxe-table-column>
                  <vxe-table-column field="qcitemvalueid" title="靶值标准ID" width="100" header-align="center"></vxe-table-column>
                  <vxe-table-column field="qcid" title="质控品ID" width="100" header-align="center"></vxe-table-column>
              </vxe-table>
              <span slot="footer" class="dialog-footer">
                  <el-button style="margin: 0px 10px 0px 5px" @click="SaveOtherUpdate()">确定</el-button>
                  <el-button style="margin: 0px 10px 0px 5px" @click="bCopyOutControl = false">取消</el-button>
              </span>
          </div>
      </el-dialog>
      <el-dialog width="900px" height="750px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="批量评价" :visible.sync="bBatchAppraiseDlg">
          <div>
              <table>
                  <tr>
                      <td style="width:50px">评价日期</td>
                      <td>
                          <!-- width:100%;min- -->
                          <el-date-picker v-model="batchapprdate" :able="false" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100px;" :clearable="false" @change="batchaprrquery">
                          </el-date-picker>
                      </td>
                      <td style="width:50px">质控品</td>
                      <td>
                          <el-select v-model="batchqcid" style="width:250px" clearable @change="batchaprrquery">
                              <el-option v-for="(item, index) in batchQcsOption" :key="index" :label="item.label" :value="item.value">{{ item.label }}</el-option>
                          </el-select>
                      </td>
                      <!-- <td>
                          <el-checkbox v-model="batchdateqc" size="mini" true-label="1" false-label="0" @change="queryDate_change">当日已做质控</el-checkbox>
                      </td>
                      <td>
                          <el-checkbox v-model="batchnoappr" size="mini" true-label="1" false-label="0" @change="queryDate_change">批量评价</el-checkbox>
                      </td> -->
                      <!-- <td>  <el-button icon="el-icon-success" @click="batchAppraise">批量评价</el-button></td> -->
                  </tr>
                  <tr>
                      <td style="width:50px">统一评价</td>
                      <td colspan="5">
                          <el-input v-model="batchapprtext" @dblclick.native="ShowAdvice(99)"></el-input>
                      </td>
                      <td>
                          <el-button style="margin: 0px 0px 0px 0px" icon="el-icon-finished" @click="inputchk()" v-has="'PINQUERY'">录入勾选项</el-button>
                      </td>
                  </tr>
              </table>
          </div>
          <div style="margin-top: 1px; height: 100%; width: 100%">
              <!-- height="auto" -->
              <vxe-table ref="xTableBatchAppraise" width="100%" height="400px" :loading="bApprLoading" :select-config="{ reserve: true }" :data.sync="batchAppraiseData" border size="mini" :keyboard-config="keyConfig" :mouse-config="{ selected: true }" show-header-overflow highlight-current-row highlight-hover-row resizable :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }" @current-change="AppraiseChange" :key="appraiseDataKey" :row-class-name="AppraiseRowClassName">
                  <vxe-table-column type="selection" width="40" align="center"></vxe-table-column>
                  <vxe-table-column field="qcdate" title="评价日期" width="90px" :formatter="['toDateString', 'yyyy-MM-dd']" align="center">
                  </vxe-table-column>
                  <vxe-table-column field="qcid" title="质控品ID" width="70px" header-align="center">
                  </vxe-table-column>
                  <vxe-table-column field="qcname" title="质控品" width="100px" header-align="center">
                  </vxe-table-column>
                  <vxe-table-column field="batchno" title="批号" width="90px" header-align="center">
                  </vxe-table-column>
                  <vxe-table-column field="qclevel" title="水平" width="40px" header-align="center">
                  </vxe-table-column>
                  <vxe-table-column field="rpt_itemname" title="项目名称" width="150px" header-align="center">
                  </vxe-table-column>
                  <vxe-table-column field="appraisetext" title="评价内容" width="300px" header-align="center" :edit-render="{ name: 'input' }">
                      <template v-slot:edit="{ row }">
                          <el-input v-model="row.appraisetext" @dblclick.native="row.appraiseuser == null ? ShowAdvice(5, row) : ''" :disabled="row.appraiseuser != null"></el-input>
                      </template>
                  </vxe-table-column>
                  <!-- <vxe-table-column field="appraisetime" title="操作时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']" align="center"></vxe-table-column>
                  <vxe-table-column field="appraiseusername" title="操作人" width="70px" align="center"></vxe-table-column> -->
              </vxe-table>
          </div>
          <div slot="footer" class="dialog-footer">
              <el-button @click="SaveSelectAppr()">保存勾选评价</el-button>
              <el-button @click="bBatchAppraiseDlg = false">取 消</el-button>
          </div>
      </el-dialog>
      <!--失控处理验证-->
      <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="失控处理验证" :visible.sync="bVerifyDlg" width="1320px">
          <div style="border: 1px solid #ccc;">
              <table style="font-size: 12px">
                  <tr>
                      <td> {{ datename }}
                          <!-- <el-dropdown @command="handleCommand" style="font-size: 12px;">
                                      <u class="el-dropdown-link">
                                          {{ datename }}
                                      </u>
                                      <el-dropdown-menu slot="dropdown">
                                          <el-dropdown-item command="标本日期">
                                              <font font-size="12px">标本日期</font>
                                          </el-dropdown-item>
                                          <el-dropdown-item command="审核日期">
                                              <font font-size="12px">审核日期</font>
                                          </el-dropdown-item>
                                          <el-dropdown-item command="报告日期">
                                              <font font-size="12px">报告日期</font>
                                          </el-dropdown-item>
                                      </el-dropdown-menu>
                                  </el-dropdown> -->
                      </td>
                      <td>
                          <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" :clearable="false" style="width: 120px" v-model="detObj.startdate" type="date"></el-date-picker>
                      </td>
                      <td>至</td>
                      <td>
                          <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" :clearable="false" style="width: 120px" v-model="detObj.enddate" type="date"></el-date-picker>
                      </td>
                      <td>更换日期</td>
                      <td>
                          <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" :clearable="false" style="width: 160px" v-model="detObj.changedate" type="datetime"></el-date-picker>
                      </td>
                      <td>检验仪器</td>
                      <td>
                          <rm-ddl-instrument width="150px" v-model="detObj.outinstrid" prgno="LIS530" :clearable="false" :bPower="true"></rm-ddl-instrument>
                      </td>
                      <td>报告单元</td>
                      <td>
                          <rm-ddl-rptunit :clearable="true" defaultflag="" v-model="detObj.rptunitid" width="150px" :multiple_choice="false" :targetId="true"></rm-ddl-rptunit>
                      </td>
                      <td style="color:blue">{{detObj.rptitemna}}</td>
                      <td colspan="4" align="right">
                          <el-button @click="btndetQuery" type="primary" icon="el-icon-search">查 询</el-button>
                          <el-button @click="btndetSave" icon="el-icon-document">确 定</el-button>
                          <el-button @click="bVerifyDlg = false" icon="el-icon-close">取 消</el-button>
                      </td>
                  </tr>
              </table>
          </div>
          <div style="height:500px;width: 100%;margin-top:5px">
              <rm-layout-top splitcolor="white" :splitwidth=5 :fixsize=190>
                  <template v-slot:fix>
                      <div style="height:190px;">
                          <vxe-table :data.sync="detObj.topTableData" border fit :mouse-config="{selected: true}" :edit-config="{trigger: 'click', mode: 'cell',showStatus: true,showIcon:false}" :keyboard-config="keyConfig" height="auto" header-align="center" ref="topTable" resizable show-header-overflow="tooltip" show-overflow="tooltip" size="mini" :cell-class-name="cellClassName">
                              <vxe-table-column field="rpt_itemname" title="验证项目" width="130" sortable></vxe-table-column>
                              <!-- <vxe-table-column field="batchnof" title="处理前试剂批号" width="100" sortable></vxe-table-column> -->
                              <vxe-table-column field="samplenof" title="处理前标本号" width="90" sortable header-align="center"></vxe-table-column>
                              <vxe-table-column field="barcodef" title="处理前条码号" width="90" sortable header-align="center"></vxe-table-column>
                              <vxe-table-column field="result_strf" title="处理前结果" width="80" sortable align="center"></vxe-table-column>
                              <vxe-table-column field="pat_no" title="病历号" width="70" sortable align="center"></vxe-table-column>
                              <vxe-table-column field="pat_name" title="姓名" width="60" sortable align="center"></vxe-table-column>
                              <!-- <vxe-table-column field="batchnob" title="处理后试剂批号" width="100" sortable></vxe-table-column> -->
                              <vxe-table-column field="samplenob" title="处理后标本号" width="90" sortable></vxe-table-column>
                              <vxe-table-column field="barcodeb" title="处理后条码号" width="90" sortable header-align="center"></vxe-table-column>
                              <vxe-table-column field="result_strb" title="处理后结果" width="80" sortable></vxe-table-column>
                              <vxe-table-column field="bias" title="偏倚%" width="70" sortable></vxe-table-column>
                              <vxe-table-column field="tea" :title="teaflag=='0'?'1/2Tea':teaflag=='1'?'1/3Tea':teaflag=='2'?'阴阳性一致':''" width="70" sortable align="center" header-align="center"></vxe-table-column>
                              <vxe-table-column field="verifyflag" title="合格" width="60" sortable align="center"></vxe-table-column>
                              <vxe-table-column field="verifyer" title="校验人" width="70" sortable align="center"></vxe-table-column>
                              <vxe-table-column field="verifydt" title="检验时间" width="110" sortable align="center"></vxe-table-column>
                              <vxe-table-column field="reportidf" title="处理前报告ID" width="110" sortable></vxe-table-column>
                              <vxe-table-column field="reportidb" title="处理后报告ID" width="110" sortable align="center" header-align="center"></vxe-table-column>
                              <vxe-table-column field="lcdetailid" title="更换记录明细ID" width="100" sortable header-align="center"></vxe-table-column>
                          </vxe-table>
                      </div>
                  </template>
                  <rm-layout-right splitcolor="white" movingcolor="#00ffff" :splitwidth=5 fixsize="50%">
                      <template v-slot:fix>
                          <div style="height:100%">
                              <vxe-table :data.sync="detObj.prxTableData" :loading="detObj.pxTableLoading" border fit :mouse-config="{selected: true}" :edit-config="{trigger: 'click', mode: 'cell',showStatus: true,showIcon:false}" :keyboard-config="keyConfig" height="auto" header-align="center" ref="prxTable" resizable show-header-overflow="tooltip" show-overflow="tooltip" size="mini" :sort-config="{trigger: 'cell'}" :row-class-name="rowClassName">
                                  <vxe-table-column field="ischkflag" title="选择" width="50" sortable align="center">
                                      <template v-slot="{row}">
                                          <el-checkbox true-label="1" false-label="0" v-model="row.ischkflag" @change="chkflagChange('rx',row)"></el-checkbox>
                                      </template>
                                  </vxe-table-column>
                                  <vxe-table-column field="sampleno" title="样本号" width="90" sortable></vxe-table-column>
                                  <vxe-table-column field="barcode" title="条码号" width="90" sortable header-align="center"></vxe-table-column>
                                  <vxe-table-column field="result_str" title="检验结果" width="70" sortable align="center"></vxe-table-column>
                                  <vxe-table-column field="result_flag" title="标志" width="60" sortable align="center"></vxe-table-column>
                                  <vxe-table-column field="pat_no" title="病人号" width="70" sortable align="center"></vxe-table-column>
                                  <vxe-table-column field="pat_name" title="病人姓名" width="70" sortable align="center"></vxe-table-column>
                                  <vxe-table-column field="rpt_itemname" title="报告项目名称" width="120" sortable align="center"></vxe-table-column>
                                  <vxe-table-column field="rpt_itemcode" title="报告项目代码" width="100" sortable align="center"></vxe-table-column>
                                  <vxe-table-column field="cp_resultdt" title="结果时间" width="120" sortable></vxe-table-column>
                                  <vxe-table-column field="reportid" title="报告ID" width="110" sortable></vxe-table-column>
                              </vxe-table>
                          </div>
                      </template>

                      <div style="height:100%;width:100%;background-color:#ddccbb;">
                          <vxe-table :data.sync="detObj.plxTableData" :loading="detObj.pxTableLoading" border fit :mouse-config="{selected: true}" :edit-config="{trigger: 'click', mode: 'cell',showStatus: true,showIcon:false}" :keyboard-config="keyConfig" height="auto" header-align="center" ref="plxTable" resizable show-header-overflow="tooltip" show-overflow="tooltip" size="mini" :sort-config="{trigger: 'cell'}" :row-class-name="rowClassName">
                              <vxe-table-column field="ischkflag" title="选择" width="50" sortable align="center">
                                  <template v-slot="{row}">
                                      <el-checkbox true-label="1" false-label="0" v-model="row.ischkflag" @change="chkflagChange('lx',row)"></el-checkbox>
                                  </template>
                              </vxe-table-column>
                              <vxe-table-column field="sampleno" title="样本号" width="90" sortable></vxe-table-column>
                              <vxe-table-column field="barcode" title="条码号" width="90" sortable header-align="center"></vxe-table-column>
                              <vxe-table-column field="result_str" title="检验结果" width="70" sortable align="center"></vxe-table-column>
                              <vxe-table-column field="result_flag" title="标志" width="60" sortable align="center"></vxe-table-column>
                              <vxe-table-column field="pat_no" title="病人号" width="70" sortable align="center"></vxe-table-column>
                              <vxe-table-column field="pat_name" title="病人姓名" width="70" sortable align="center"></vxe-table-column>
                              <vxe-table-column field="rpt_itemname" title="报告项目名称" width="120" sortable align="center"></vxe-table-column>
                              <vxe-table-column field="rpt_itemcode" title="报告项目代码" width="100" sortable align="center"></vxe-table-column>
                              <vxe-table-column field="cp_resultdt" title="结果时间" width="120" sortable></vxe-table-column>
                              <vxe-table-column field="reportid" title="报告ID" width="110" sortable></vxe-table-column>
                          </vxe-table>
                      </div>
                  </rm-layout-right>
              </rm-layout-top>
          </div>
      </el-dialog>
      <!-- 不分批号多选 -->
      <el-dialog width="300px" height="300px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="多选新增" :visible.sync="bAddQcDataDlg ">
          <table>
              <tr style="text-align:right">
                  <td width="10px">结果时间</td>
                  <td>
                      <el-date-picker v-model="adddataresultdt" type="datetime" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss" style="width:170px"></el-date-picker>
                  </td>
              </tr>
              <tr style="text-align:right">
                  <td width="10px">结果标识</td>
                  <td>
                      <el-input v-model="adddatasign" style="width:100px"></el-input>
                  </td>
              </tr>
          </table>
          <div style="margin-top: 1px; height: 100%; width: 100%">
              <vxe-table :data.sync="addQcData" :select-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="400px" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="addQc" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{animat: false}" header-align="center" :key="listqccalckey" :span-method="colspanMethod" :row-class-name="ResultRowName" :tree-config="{children: 'children', expandAll: true, trigger: 'row'}">
                  <!-- <vxe-table-column :key="item.field" :field="item.field" :title="item.title" v-for="item in tableColumn" align="center" :width="item.width" sortable :sort-width="item.field=='sampleno'?20:0"></vxe-table-column> -->
                  <vxe-table-column type="selection" width="40" align="center"></vxe-table-column>
                  <vxe-table-column field="batchno" title="批号" width="120px"></vxe-table-column>
                  <vxe-table-column field="qclevel" title="水平" width="45px" align="center"></vxe-table-column>
              </vxe-table>
              <span slot="footer" class="dialog-footer" style="float:right">
                  <el-button style="margin: 0px 10px 0px 5px" @click="funAddQcData()">确定</el-button>
                  <el-button style="margin: 0px 10px 0px 5px" @click="bAddQcDataDlg = false">取消</el-button>
              </span>
          </div>
      </el-dialog>
      <el-dialog title="重新判定区间数据" width="320px" :visible.sync="bQcCalcPreDlg">
          <table>
              <tr>
                  <td style="text-align:left;font-weight:600">当前仪器:{{instrName}}({{instrId}})</td>
              </tr>
              <tr>
                  <td style="text-align:left;font-weight:600">质控日期:{{queryDate[0]}}~{{queryDate[1]}}</td>
              </tr>
              <tr>
                  <td style="text-align:left;font-weight:600">区间质控数据重置为未判定，您确定要继续进行操作吗？</td>
              </tr>
              <tr style="text-align:right">
                  <td style="padding-top: 5px;width: 350px;">
                      <el-button style="margin: 0px 0px 0px 0px" @click="setControlStatusNull()" v-has="'PINQUERY'">确定</el-button>&nbsp;
                      <el-button style="margin: 0px 0px 0px 0px" @click="bQcCalcPreDlg=false" v-has="'PINQUERY'">取消</el-button>
                  </td>
              </tr>
          </table>
      </el-dialog>
      <!-- 靶值维护 -->
      <el-dialog width="1100px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="'靶值设定 当前项目：' +rptitemname" :visible.sync="targetSetDialogVisible">
          <div style="width: 100%; height: 502px; position: relative; border: 1px solid #ccc">
              <div style="width: 100%; margin: 2px 0px">
                  <div style="float: left; width: 30%">
                      <vxe-table show-overflow ref="xTable61" height="460px" width="100%" :loading="loading" :select-config="{ reserve: true }" :data.sync="tableData61" border size="mini" :keyboard-config="keyConfig" :mouse-config="{ selected: true }" show-header-overflow highlight-current-row highlight-hover-row resizable stripe :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }" @current-change="itemModeList_changed" :key="table61key">
                          <vxe-table-column type="index" title="NO." width="30"></vxe-table-column>
                          <vxe-table-column field="qcname" title="质控品名称" width="130" header-align="center"></vxe-table-column>
                          <vxe-table-column field="batchno" title="批号" width="120px" header-align="center"></vxe-table-column>
                          <vxe-table-column field="qclevel" title="水平" width="40px" header-align="center">
                          </vxe-table-column>
                      </vxe-table>
                  </div>
                  <div style="float: right; width: 70%">
                      <vxe-table show-overflow ref="xTable62" height="460px" width="100%" :loading="loading" :select-config="{ reserve: true }" :data.sync="tableData62" border size="mini" :keyboard-config="keyConfig" :mouse-config="{ selected: true }" show-header-overflow highlight-current-row highlight-hover-row resizable stripe :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }" :key="table62key">
                          <!-- <vxe-table-column field="rpt_itemname" title="报告项目" width="160" header-align="center"></vxe-table-column> -->
                          <vxe-table-column field="begindt" title="靶值启用日期" width="120" :formatter="['toDateString', 'yyyy-MM-dd']" align="center"></vxe-table-column>
                          <vxe-table-column field="tagvalue" title="靶值" width="80" :edit-render="{ name: 'input', events: { change: calcCvSd } }" header-align="center" align="right"></vxe-table-column>
                          <vxe-table-column field="sd" title="SD" width="80" :edit-render="{ name: 'input', events: { change: calcCvTagvalue } }" header-align="center" align="right"></vxe-table-column>
                          <vxe-table-column field="cv" title="CV" width="80" :edit-render="{ name: 'input', events: { change: calcSdTagvalue } }" header-align="center" align="right"></vxe-table-column>
                          <vxe-table-column field="limithigh" title="失控上限" :edit-render="{ name: 'input' }" width="100" header-align="center" align="right"></vxe-table-column>
                          <vxe-table-column field="limitlow" title="失控下限" width="100" :edit-render="{ name: 'input' }" header-align="center" align="right"></vxe-table-column>
                          <vxe-table-column field="lastmodifydt" title="最后修改时间" width="110" :formatter="['toDateString', 'yyyy-MM-dd']" align="center"></vxe-table-column>
                          <vxe-table-column field="lastmodifyuser" title="最后修改人" width="100" align="center"></vxe-table-column>
                          <vxe-table-column field="stopdt" title="停用时间" width="90" :formatter="['toDateString', 'yyyy-MM-dd']" align="center"></vxe-table-column>
                          <vxe-table-column field="stopuser" title="停用者" width="100" align="center"></vxe-table-column>
                          <vxe-table-column field="rpt_itemcode" title="报告项目编码" width="160" header-align="center"></vxe-table-column>
                          <vxe-table-column field="qcitemvalueid" title="靶值ID" width="80" header-align="center"></vxe-table-column>
                      </vxe-table>
                  </div>
              </div>
          </div>
          <span slot="footer" class="dialog-footer">
              <el-button icon="el-icon-search" @click="targetSetItemModeList()">刷新</el-button>
              <el-button icon="el-icon-plus" @click="targetSetAdd()">新增靶值启用日期</el-button>
              <el-button icon="el-icon-delete" @click="targetSetDelete()">删除靶值启用日期</el-button>
              <el-button icon="el-icon-lock" v-if="!bLockCv" @click="!bLockCv?bLockCv = true:bLockCv = false">锁定CV</el-button>
              <el-button icon="el-icon-unlock" v-if="bLockCv" @click="!bLockCv?bLockCv = true:bLockCv = false">解除锁定CV</el-button>
              <!-- <el-button icon="el-icon-document" @click="targetSetCalc()">计算靶值</el-button> -->
              <el-button icon="el-icon-success" @click="targetSetSave_click()">保存</el-button>
              <el-button icon="el-icon-close" @click="targetSetClose()">退出</el-button>
          </span>
          <!-- 
          <el-dialog width="350px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="将 靶值数据 复制到 目标日期中" :visible.sync="targetSetCopyDialogVisible">
              <div style="width: 100%; padding: 10px 0px">
                  <span class="demonstration">目标日期：</span>
                  <el-date-picker v-model="targetSetCopyBegindt" type="date" placeholder="靶值启用日期" style="width: 70%"></el-date-picker>
              </div>
              <div style="width: 100%; padding: 5px 0px"></div>
              <el-checkbox v-model="targetSetCopyCover">覆盖目标日期中原有数据</el-checkbox>
              <span slot="footer" class="dialog-footer">
                  <el-button icon="el-icon-success" @click="targetSetCopyOK()">确定</el-button>
                  <el-button icon="el-icon-close" @click="targetSetCopyClose()">退出</el-button>
              </span>
          </el-dialog>
          <el-dialog width="1020px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="计算靶值数据" :visible.sync="targetSetCalcDialogVisible">
              <table style="width: 100%;height:70px; font-size: 12px;" border="0">
                  <tr>
                      <td>日期:</td>
                      <td>
                          <el-date-picker v-model="targetSetCalcDt[0]" type="date" placeholder="开始日期" value-format="yyyy-MM-dd" style="width: 130px" :clearable="false"></el-date-picker>
                      </td>
                      <td>~</td>
                      <td>
                          <el-date-picker v-model="targetSetCalcDt[1]" type="date" placeholder="结束日期" value-format="yyyy-MM-dd" style="width: 130px" :clearable="false"></el-date-picker>
                      </td>
                      <td>
                          <el-radio-group v-model="targetSetCalcType" style="padding: 0px 10px" size="mini" @change="targetSetCalcType_changed">
                              <el-radio-button label="0">全部计算</el-radio-button>
                              <el-radio-button label="1">仅计算靶值</el-radio-button>
                              <el-radio-button label="2">仅计算SD</el-radio-button>
                          </el-radio-group>
                      </td>
                      <td>
                          <el-checkbox style="padding: 0px 0px 0px 0px" v-model="targetSetCalcInuse">包含非累积数据</el-checkbox>
                          <el-checkbox v-model="targetSetCalcDraw">包含非画图数据</el-checkbox>
                          <el-checkbox v-model="targetSetCalc3sd">包含3SD值</el-checkbox>
                      </td>
                      <td></td>

                  </tr>
                  <tr>
                      <td colspan="3 " style="text-align: left;">
                          <el-checkbox style=" padding: 0px 0px 0px 0px" v-model="bCalc1">每日数据仅计算一次</el-checkbox>
                      </td>
                      <td colspan="4" v-if="bCalc1">计算第 <el-input-number v-model="calcdaynum" controls-position="right" :min="1" :max="99" style="width:120px"></el-input-number>次数据</td>
                  </tr>
              </table>
            
              <vxe-table style="float: left; width: 50%" show-overflow ref="xTable71" width="100%" height="420px" border :loading="loading" :select-config="xTable71CheckAll" :data.sync="tableData71" size="mini" :keyboard-config="keyConfig" :mouse-config="{ selected: true }" show-header-overflow highlight-current-row highlight-hover-row resizable stripe :row-class-name="targetSetRowClassName" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }" @current-change="targetSetCalcRptitem_changed">
                  <vxe-table-column type="selection" width="50" align="center"></vxe-table-column>
                  <vxe-table-column field="rpt_itemname" title="报告项目" width="200" header-align="center"></vxe-table-column>
                  <vxe-table-column field="tagvalue" title="靶值" width="70" header-align="center" align="right" :edit-render="{ name: 'input', events: { change: calcCvSd } }"></vxe-table-column>
                  <vxe-table-column field="sd" title="SD" width="70" header-align="center" align="right" :edit-render="{ name: 'input', events: { change: calcCvTagvalue } }"></vxe-table-column>
                  <vxe-table-column field="cv" title="CV" width="70" header-align="center" align="right"></vxe-table-column>
              </vxe-table>
              <vxe-table style="float: right; width: 50%" show-overflow ref="xTable72" width="100%" height="420px" border :loading="loading" :select-config="{ reserve: true }" :data.sync="tableData72" size="mini" :keyboard-config="keyConfig" :mouse-config="{ selected: true }" show-header-overflow highlight-current-row highlight-hover-row resizable stripe :row-class-name="targetSetRowClassName" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }">
                  <vxe-table-column field="resultdt" title="结果时间" width="100" :formatter="['toDateString', 'yyyy-MM-dd']" align="center"></vxe-table-column>
                  <vxe-table-column field="calculatevalue" title="计算结果" width="80" align="center"></vxe-table-column>
                  <vxe-table-column field="inuseflag" title="累计标志" width="80" align="center"></vxe-table-column>
                  <vxe-table-column field="drawflag" title="画图标志" width="80" align="center"></vxe-table-column>
                  <vxe-table-column field="calculatesd" title="计算SD" width="80" align="center"></vxe-table-column>
              </vxe-table>
              <span slot="footer" class="dialog-footer">
                  <el-button style="margin: 10px 10px 0px 5px" icon="el-icon-search" @click="targetSetCalcQuery()">刷新</el-button>
                  <el-button style="margin: 10px 10px 0px 5px" icon="el-icon-success" @click="targetSetCalcOK()">计算</el-button>
                  <el-button style="margin: 10px 10px 0px 5px" icon="el-icon-success" @click="targetSetCalcSave()">保存</el-button>
                  <el-button style="margin: 10px 10px 0px 5px" icon="el-icon-close" @click="targetSetCalcClose()">退出</el-button>
              </span>
          </el-dialog> -->
      </el-dialog>
      <el-dialog :width="'230px'" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="输入靶值启用日期" :visible.sync="targetSetBegindtDialogVisible">
          <el-date-picker v-model="targetSetBegindt" type="date" placeholder="靶值启用日期" style="width:130px"></el-date-picker>
          <span slot="footer" class="dialog-footer">
              <el-button icon="el-icon-success" @click="targetSetBegindtOK()">确定</el-button>
              <el-button icon="el-icon-close" @click="targetSetBegindtClose()">退出</el-button>
          </span>
      </el-dialog>
      <el-dialog :width="'730px'" height="500px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="失控处理流程帮助" :visible.sync="outcontrolshowDlg">
          <!-- <img  :src="outcontrolshowImg" fit="scale-down" style="width: 700px; height: 500px"  /> -->
          <el-image style="width: 100%; height: 100%;padding:5 5 5 5;border: 1px solid #ccc;" :src="outcontrolshowImg" :preview-src-list="[outcontrolshowImg]"></el-image>
      </el-dialog>
  </div>
</template>

<script type="text/javascript">
import XEUtils from "xe-utils"; //引入工具类
import echarts from "echarts"; //引入echarts
import { EleResize } from "../../../common/esresize.js";
// import printJS from "print-js";

XEUtils.mixin({
  // 自定义全局的格式化处理函数
  formatSelect(cellValue, list) {
      let item = list.find((item) => item.value == cellValue);
      return item ? item.label : cellValue;
  },
});
export default {
  name: "LIS530",
  data() {
      return {
          //~~~~~~~~~~模糊查询~~~~~~~~~~~//
          txtsearch: "",
          txtsearchbatch: "",
          marklinedata: [],
          //~~~~~~~~~~维护靶值~~~~~~~~~~~//
          targetSetDialogVisible: false, //靶值设定dlg
          bLockCv: false, //锁定CV
          tableData61: [],
          tableData62: [],
          table61key: 1, //强制刷新标记
          table62key: 1, //强制刷新标记
          targetSetBegindtDialogVisible: false, //靶值设定: 新增启用日期弹窗中也使用
          targetSetBegindt: null, //靶值设定 启用日期 ，新增启用日期弹窗中也使用
          targetSetCopyDialogVisible: false, //靶值设定：弹窗显示
          targetSetCopyBegindt: null, //靶值设定：复制靶值弹窗、目标数据
          targetSetCopyFlag: "0", //靶值设定:新增靶值弹窗 0:仅新增，1不覆盖复制，2覆盖复制
          targetSetCopyCover: false, //靶值设定：复制靶值弹窗、覆盖原有数据
          targetSetCalcDialogVisible: false, //靶值设定-靶值计算弹窗
          tableData71: [], //靶值设定-靶值计算弹窗，左边列表
          tableData72: [], //靶值设定-靶值计算弹窗，右边列表
          targetSetCalcDt: [], //靶值设定-靶值计算弹窗：起始结束日期
          targetSetCalcInuse: false, //靶值设定-靶值计算弹窗：包含非累计数据
          bCalc1: false, //靶值设定-靶值计算弹窗：仅计算1次标记
          targetSetCalcDraw: false, //靶值设定-靶值计算弹窗：包含非画图数据
          targetSetCalc3sd: false, //靶值设定-靶值计算弹窗：包含3sd值
          targetSetCalcType: "0", //靶值设定-靶值计算弹窗：仅计算靶值、仅计算SD
          //~~~~~~~~~~end~~~~~~~~~~~~~~~//
          loading: false,
          testmethod: "",
          visualmap: [], //隐藏更换批号/靶值数据之间连线
          tabsValue: "0", //右边标签，选中的标签
          batchno: "", //选择的当前的项目
          fullDataKey: 1, //所有数据标签 强制刷新标记
          showDataKey: 1, //有效数据标签 强制刷新标记
          appraiseDataKey: 1, //有效数据标签 强制刷新标记
          charts: "", //质控图实例
          echartsAxisInterval: 31, //质控图形上最多显示多少个日期 ，推荐printQcdataLen *3 的数量
          tableDataBatch: [], //批号列表
          tableDataRptitem: [], //项目列表
          showmonthincontrol: "0", //显示本月在控数据标志 
          showcumcontrol: "0", //显示累积在控数据标志
          renamecurrentcontrol: "当前在控", //重命名当前在控列
          hideinstrqcval: false, //隐藏仪器原始结果列
          hidelastuserndt: false, //隐藏最后修改人，最后修改时间
          showreagent: "0", //质控图显示试剂批号，试剂厂商，校准品批号，校准品厂商信息
          rptitemAll: [], //所有项目数据标签中项目下拉列表
          rptitemAllSelect: "", //所有项目数据标签中项目下拉列表
          qclevelAllSelect: "", //所有项目数据标签中水平下拉列表
          qclevelAllEnable: "", //所有项目数据标签中水平Options
          tableDataFull: [], //查询出的全部数据
          monthNormalData: [], //获取当月非失控
          cumNormalData: [], //获取累积非失控
          tableDataAll: [], //所有项目数据标签中的数据
          allDataVisible: "0",
          tableDataShow: [], //有效数据（累计数据或画图数据）
          drawpointData: [], //有效数据 中的画图数据
          tableAppraiseData: [], //质控评价数据
          tableDataLines: [], //线条的显示信息
          tableDataLinesunion: [], //新线条显示信息（合并）
          tableDataPrintQcdata: [], //打印质控图弹窗中，质控数据明细
          tableDataOutcontrol: [], ///打印质控图弹窗中，失控数据列表
          hideappraise: "0", //质控图打印隐藏质控评价 
          itemjudge: [], //定性质控，画图时Y轴内容
          splitLineColor: [], //画图Y轴线条颜色 
          singlelevelshownum: {}, //单水平单批号时Y轴显示数值， 记录Y轴数值
          slvshownum: "0", //更改为页面选项，如仪器选项勾选了 这边就默认勾选。
          chartData: [], //画图数据
          drawTitleText: "", //画图顶部的说明文
          echartImg: "", //放 echart 的 base64码  <img v-bind:src="echartImg" />
          echartSplitNumber: 8, //Y轴刻度 ，定性质控也用到
          printDialogvisible: false, //打印质控图时 预览弹窗
          printQcKey: 1, //打印质控图时强制刷新
          hospitalname: "", //医院名称
          printQcFilecode: "", //打印时的文件编号
          printQcdataDate: [], //打印弹窗中，数据日期列（暂定最多 printQcdataLen *5 天）
          printQcdataLen: 15, //打印具体数据为每行15列
          printQcdataRow: 3, //打印具体数据3行
          printQcHeader: [], //打印质控图 Header 区域内容
          printQcFooter: [], //打印质控图 Footer 区域内容
          printQcTilteText: [], //打印质控图 顶部的文字
          printQcEndText: [], //打印质控图 底部的文字
          printInusedata: [], //质控图打印时的线条 累计信息
          printILastmonthdata: [], //质控图打印时的线条 上月信息
          printcheck: 0, //质控图打印显示签名人 美年需求
          categorytype: 0, //质控线的显示方式
          bCategory: false,
          //   以下为查询条件
          queryDate: [], //起始结束日期
          bAllSLoading: false, //添加对所有数据Loading显示(空质控项目加载慢)
          datekey: 0, //所有数据日期刷新 //修改日期组件刷新key值
          // starkey1: 0, //所有数据日期刷新
          // endkey2: 0, //所有数据日期刷新
          instrId: 0,
          instrName: "",
          allbatch: "0", //0单批号、1不分批号、2批号多选
          showallbatch: "0", //显示所有批号
          multi: "0", //多图

          showother: "1", //显示非累计点
          gtype: "0", //0所有点 、1最后点、 2最好点
          queryQclevelCode: [], //用户勾选水平的编码
          queryQclevel: [], //用户 勾选的水平
          queryQclevelEnable: [], //允许用户勾选的水平
          queryQclevels: [], // ["水平1", "水平2", "水平3", "水平4", "水平5", "水平6"], //全部水平列表
          rptitemcode: "", //右边所选择的项目
          rptitemname: "", //项目名称 用于数据打印
          //所有项目标签 选项
          powRet: 0, //质控录入授权
          queryDateAll: [], //起始结束日期
          qcrule: {}, //当前所选择项目的质控规则
          qcruletype: "",
          qcOption: {}, //仪器的质控选项
          QC1_2SALTER: "",
          westgardOption: [
              { label: "Westgard", value: 1 },
              { label: "绝对值", value: 2 },
              { label: "百分比", value: 3 },
              { label: "定性质控", value: 4 },
          ],
          controlstatusList: [
              { label: "失控", value: "0" },
              { label: "在控", value: "1" },
              { label: "动态靶值不判断", value: "2" },
              { label: "警告", value: "9" },
              { label: "未判定", value: null },
          ],
          dgList: [
              { label: "", value: "0" },
              { label: "√", value: "1" },
          ],
          qcsOption: [], //质控评价中，质控品的下拉列表
          //质控评价 button
          appChk: "0", //"1":显示提交评价按钮 "2":显示审核按钮 "0":都不显示
          //以下为质控签名窗口参数
          qcsignDialogVisible: false, //质控签名弹窗
          qcsignDate: ["", ""],
          tableDataQcsign: [], //质控签名
          xTableQcsignCheckAll: { checkAll: false }, //质控签名窗口第一列，选择
          qcsignRptitemcode: "",
          qcsignRptitemcodes: [],
          qcsignBatchno: "",
          qcsignBatchnos: [],
          qcsignChecked: "1", //质控签名窗口 all=全部 0=未审核 1=已审核
          qcsignloginflag: "0", //质控签名验证，0 按照登录用户 1需要登录1次签名人 2每次签名都需要验证
          qcoutloginflag: "0", //失控处理验证，0 按照登录用户 1需要登录1次处理人 2每次处理都需要验证
          checkflagList: [
              { label: "未审核", value: "0" },
              { label: "已审核", value: "1" },
          ],
          //设定Grid窗口 按回车键跳到下一列
          keyConfig: {
              isArrow: true,
              isDel: true,
              isTab: true,
              isEdit: true,
              editMethod: ({ seq, row, rowIndex, column, columnIndex, cell }) => {},
          },
          keyConfigItem: {
              isArrow: true,
              isDel: true,
              isTab: true,
              isEdit: true,
              editMethod: ({ seq, row, rowIndex, column, columnIndex, cell }) => {},
          },
          //以下为分割条和窗口界面布局参数
          leftwidth: 0,
          rightwidth: 1000,
          topheight: 65,
          bottomheight: 0,
          //设置左边2个窗口的大小
          leftWindowWidth: 250,
          batchWindowHeight: 170,
          rptitemWindowHeight: 280,
          //以下为修改计算结果弹窗
          Valuedialogvisible: false,
          tempqcdata: {},
          oldqcdata: {}, //质控修改结果old数据 用于累计标志及画图标志
          oldtempqcdata: {},
          qcupdatevalue: "",
          qccalupdatevalue: 0,
          qccalupdatesd: 0,
          updatereason: "",
          //失控处理弹窗
          outofcontrolvisible: false,
          qcitem: {},
          parentflag: "",
          //报告备注弹窗
          dialogAdviceVisible: false,
          appendChangeRow: false,
          advicetxt: "",
          tableDataAdvice: [],
          tableDataAdviceall: [],
          loadingAdvice: false,
          txtkind: "全部",
          txtinfoarr: [],
          infortype: -1,
          tempappraise: {},
          option2102: false,
          qcshowmaxcv: true,
          //以下为质控未判定原因
          slvshowdiagnose: "1",
          bShowUndecidedReson: false,
          floatwinna: "质控未判定诊断",
          floatwincnt: 0,
          floatwinlist: [],
          floatwinmsg: "",
          floatwintype: "",
          activeNames: ["1", "2", "3", "4"],
          //批次判定
          bListQcCalc: false,
          percentage: 0, //进度条
          listLogData: [],
          listqccalckey: 0,
          loadingtxt: "正在批次审查。",
          bClassLoading: false,
          bCopyOutControl: false,
          //批次重置审查
          listNullLogData: [],
          percentagenull: 0, //进度条
          setnullloadingtxt: "正在批次重置。",
          bListSetNull: false,
          //将失控点应用到其他点
          copyOutControlData: [],
          sBatchOtherLv: "0",
          passHandle: "1",
          //质控评价添加默认评价
          defaulttxt: "",
          bBatchAppraiseDlg: false,
          batchapprdate: XEUtils.toDateString(new Date(), "yyyy-MM-dd"),
          qcsignusername: "", //质控评价添加登录人
          qcsignuser: "",
          qcoutcontrolusername:"",//失控处理人
          qcoutcontroluser:"",
          // batchapprdate: "2020-09-13",
          batchqcid: "",
          batchdateqc: "1",
          batchnoappr: "1",
          batchapprtext: "",
          batchAppraiseData: [],
          batchQcsOption: [],
          bApprLoading: false,
          //失控验证弹窗
          bVerifyDlg: false,
          detObj: {
              startdate: this.$pub.InitDateTime2(7).datefrom, //开始日期
              enddate: this.$pub.InitDateTime2(7).dateto, //结束日期
              changedate: this.$pub.InitDateTime2(3).datefrom, //更改日期
              rptitemname: "",
              rptunitid: "",
              outinstrid: 0,
              topTableData: [],
              prxTableData: [],
              plxTableData: [],
              pxTableLoading: false,
          },
          //不分批号多选新增弹窗
          bAddQcDataDlg: false,
          addQcData: [],
          adddatasign: 1,
          adddataresultdt: new Date(),
          //批次审查
          bQcCalcPreDlg: false,
          //样本回顾
          teaflag: "",
          datename: "标本日期",
          daytype: "1",
          //失控流程图
          isqchelpouthanding: false,
          outcontrolshowImg: "",
          outcontrolshowDlg: false,
          //失控处理验证
          outinstrid: 0,
          rptkey: 0,
      };
  },
  computed: {
      com_batchWindowHeight: function () {
          return this.batchWindowHeight + "px";
      },
      com_rptitemHeight: function () {
          if (this.allbatch == "1") return "100%";
          return this.rptitemWindowHeight + "px";
          // return "70%";
      },
      //模糊查询  批号
      batchlist() {
          let filterName = this.txtsearchbatch.trim();
          if (filterName) {
              let rest = this.tableDataBatch.filter((item) => {
                  return item.batchno.toUpperCase().indexOf(filterName.toUpperCase()) > -1;
              });
              return rest;
          } else {
              return this.tableDataBatch;
          }
      },
      //模糊查询  项目
      rptitemlist() {
          let filterName = this.txtsearch.trim();
          if (filterName) {
              let rest = this.tableDataRptitem.filter((item) => {
                  return item.itemcode_en.toUpperCase().indexOf(filterName.toUpperCase()) > -1 || item.showname.indexOf(this.txtsearch) > -1 || item.inputcode.toUpperCase().indexOf(this.txtsearch.toUpperCase()) > -1;
              });
              return rest;
          } else {
              return this.tableDataRptitem;
          }
      },
  },
  //html加载完成之前，执行。执行顺序：父组件-子组件
  created() {
      this.initQuery();
      for (let i = 1; i < 13; i++) {
          // for (let i = 1; i < 7; i++) {
          let val = {
              value: i,
              label: "水平 " + i,
          };
          if (i == 10) val.label = "低";
          if (i == 11) val.label = "中";
          if (i == 12) val.label = "高";
          this.queryQclevels.push(val);
      }
  },
  //.html加载完成后执行。执行顺序：子组件-父组件
  mounted() {
      if (this.instrname == "" || this.instrname == null) {
          this.getinstr();
      }
      var echartsTheme = require("../../../common/echarts_theme_shine.json"); // echarts图形的样式配置文件
      echarts.registerTheme("shine", echartsTheme); // 注册样式
      var echartsid = document.getElementById("qcChart");
      this.charts = echarts.init(echartsid, "shine");
      this.$nextTick(() => {
          this.batchWindow_resize();
          let widthTemp = this.$refs.topwindow.offsetWidth; //初始化的宽度偏差
          this.rightwidth = widthTemp - this.leftWindowWidth;
          this.$nextTick(() => {
              this.charts.resize({ width: this.autoWidth, height: this.autoHeight }); //窗口初始化时echart大小可自适应 ;
              this.draw(); //初始化时画一个样子出来
              // console.log("mounted");
          });
      });

      //监听echart所在的div的resize事件，自适应大小。在拖动左右大小分隔条的时候起作用
      let echarts0 = this.charts;
      let listener = function () {
          echarts0.resize();
      };
      EleResize.on(echartsid, listener);

      this.charts.on("legendselectchanged", function (e) {
          var option = this.getOption();
          if (e.selected[e.name] == false) {
              option.series[e.name.substring(2) * 2 - 1].data = [];
          } else {
              option.series[e.name.substring(2) * 2 - 1].data = option.series[e.name.substring(2) * 2 - 1].data0;
          }
          this.setOption(option);
      });
  },
  updated() {},
  watch: {
      // instrId(val) {
      //     this.yq_change(this.instrId, this.instrName);
      // },
  },
  methods: {
      //~~~~~~~~~~~~~~~~~~~添加靶值维护功能~~~~~~~~~~~~~~~~~~~~~~//
      targetSet_click() {
          if (this.$refs.xTableR.getCurrentRow()) {
          } else {
              this.$message({
                  message: "请先选中待设定靶值的数据！",
                  type: "info",
              });
              return;
          }
          this.bLockCv = false;
          this.targetSetDialogVisible = true;
          this.$nextTick(() => {
              this.targetSetItemModeList();
          });
      },
      //项目模式， 左边列表就是 主页面右边的数据
      targetSetItemModeList() {
          this.tableData61 = [];
          this.tableData62 = [];
          let batchno = this.getQueryBatch();
          console.log("rpt_itemcode", this.rpt_itemcode);
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "qcsQuery",
                      instrId: this.instrId,
                      rpt_itemcode: this.rptitemcode,
                      queryDate1: this.queryDate[0],
                      queryDate2: this.queryDate[1],
                      qclevel: this.queryQclevelCode, //水平
                      batchno: this.batchno,
                      allbatch: this.allbatch, //0单批号、1不分批号、2批号多选
                  },
              })
              .then((res) => {
                  this.tableData61 = res;
                  this.$refs.xTable61.setCurrentRow(null); //这个不会自动清空
                  this.tableData62 = [];
                  this.$refs.xTable62.setCurrentRow(null); //这个不会自动清空
                  var selrow = this.$refs.xTableR.getCurrentRow();
                  if (selrow) {
                  } else {
                      this.$message({
                          message: "请先选中要计算靶值的质控品！",
                          type: "info",
                      });
                      return;
                  }
                  this.$nextTick(() => {
                      this.loadFirstRow(this.$refs.xTable61, this.itemModeListChanged);
                  });
              })
              .catch((e) => {
                  this.$alert(e, "出错");
              });
      },
      //自动加载表格的第一行，并执行回调函数
      loadFirstRow(xTable, func) {
          if (xTable != undefined) {
              this.$nextTick(() => {
                  // 加载第一行
                  var selectrow = xTable.getData(0);
                  if (selectrow) {
                      xTable.setCurrentRow(selectrow); //高亮行
                      xTable.scrollToRow(selectrow); //滚动到行
                      if (typeof func == "function") func(selectrow);
                  } else {
                      xTable.setCurrentRow(null); //这个不会自动清空
                  }
              });
          }
      },
      itemModeListChanged(row) {
          let itemModeListRow = row; //给右边Tab显示用的数据
          this.itemModeRetrieve(row.qcid, this.rptitemcode);
      },
      itemModeRetrieve(qcid, rpt_itemcode) {
          this.$refs.xTable62.setCurrentRow(null); //这个不会自动清空
          this.tableData62 = [];
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS511",
                  method: "post",
                  data: {
                      action: "tagetSetDetail",
                      qcid: qcid,
                      rpt_itemcode: rpt_itemcode,
                  },
              })
              .then((response) => {
                  this.tableData62 = response.Data;
              })
              .catch((e) => {
                  console.log("error", e);
              });
      },
      //项目模式 list窗口行变换事件
      itemModeList_changed({ row }) {
          this.itemModeListChanged(row);
      },
      //输入靶值，自动计算sd\ CV
      calcCvSd({ row }, inputValue) {
          let tagvalue = inputValue.target.value;
          let sd = row.sd;
          let cv = row.cv;
          if (this.bLockCv) {
              if (Math.abs(cv) > 0) {
                  if (Math.abs(tagvalue) > 0) {
                      row.sd = parseFloat(((cv * tagvalue) / 100).toFixed(4));
                      return;
                  }
              }
          } else {
              if (Math.abs(tagvalue) > 0) {
                  if (Math.abs(sd) > 0) {
                      row.cv = parseFloat(((sd * 100) / tagvalue).toFixed(4));
                      return;
                  }
                  if (Math.abs(cv) > 0) {
                      row.sd = parseFloat(((cv * tagvalue) / 100).toFixed(4));
                      return;
                  }
              }
          }
          row.cv = null;
          row.sd = null;
      },
      //输入SD，自动计算tagvalue \CV
      calcCvTagvalue({ row }, inputValue) {
          let sd = inputValue.target.value;
          let tagvalue = row.tagvalue;
          let cv = row.cv;
          if (this.bLockCv) {
              if (Math.abs(cv) > 0) {
                  if (Math.abs(sd) > 0) {
                      row.tagvalue = parseFloat(((sd * 100) / cv).toFixed(4));
                      return;
                  }
                  // if (Math.abs(tagvalue) > 0) {
                  //     // row.tagvalue = parseFloat(((sd * 100) / cv).toFixed(4));
                  //     row.sd = parseFloat(((cv * tagvalue) / 100).toFixed(4));
                  //     return;
                  // }
              }
          } else {
              if (Math.abs(sd) > 0) {
                  if (Math.abs(tagvalue) > 0) {
                      row.cv = parseFloat(((sd * 100) / tagvalue).toFixed(4));
                      return;
                  }
                  if (Math.abs(cv) > 0) {
                      row.tagvalue = parseFloat(((sd * 100) / cv).toFixed(4));
                      return;
                  }
              }
          }
          row.cv = null;
          row.tagvalue = null;
      },
      //输入CV  自动计算 SD \Tagvalue
      calcSdTagvalue({ row }, inputValue) {
          let cv = inputValue.target.value;
          let tagvalue = row.tagvalue;
          let sd = row.sd;
          if (Math.abs(cv) > 0) {
              if (Math.abs(tagvalue) > 0) {
                  row.sd = parseFloat(((cv * tagvalue) / 100).toFixed(4));
                  return;
              }
              if (Math.abs(sd) > 0) {
                  row.tagvalue = parseFloat(((sd * 100) / cv).toFixed(4));
                  return;
              }
          }
          row.sd = null;
          row.tagvalue = null;
      },
      targetSetBegindtOK() {
          //targetSetCopyFlag:"0",//靶值设定:新增靶值弹窗 0:不复制，1覆盖复制，2不覆盖复制
          //日期模式下
          //校验 日期是否存在
          for (let i in this.tableData62) {
              if (XEUtils.toDateString(this.tableData62[i].begindt, "yyyy-MM-dd") == XEUtils.toDateString(this.targetSetBegindt, "yyyy-MM-dd")) {
                  this.$message({
                      message: "靶值启用日期和已有日期重复，请重新输入！",
                      type: "error",
                  });
                  return;
              }
          }
          var records = {};
          records.begindt = this.targetSetBegindt;
          var selectrow = this.$refs.xTable61.getCurrentRow();
          if (selectrow) {
              records.rpt_itemcode = selectrow.rpt_itemcode;
              records.rpt_itemname = selectrow.rpt_itemname;
          }
          this.$refs.xTable62.insertAt(records, -1); //在最后添加一行
          var curow = this.$refs.xTable62.getTableData().fullData[this.$refs.xTable62.getTableData().fullData.length - 1]; //获取 新加的行对象 row 数据集合
          this.$refs.xTable62.setCurrentRow(curow); //高亮显示行
          this.targetSetBegindtDialogVisible = false;
          this.tablekey61++;
          this.tablekey62++;
          this.$nextTick(() => {
              this.$refs.xTable62.scrollToRow(curow); //待数据加载完成后，延迟 滚动 到行
          });
      },
      targetSetAdd() {
          this.targetSetBegindt = new Date();
          this.targetSetCopyFlag = "0";
          this.targetSetBegindtDialogVisible = true;
      },
      targetSetSave_click() {
          //在事件里校验数据
          var begindt = "";
          var selrow = this.$refs.xTable61.getCurrentRow();
          var rpt_itemcode = this.rptitemcode;
          if (selrow) {
          } else {
              this.$message({
                  message: "请先选中要设定的质控品！",
                  type: "info",
              });
          }
          var recordset = this.$refs.xTable62.getRecordset(); //定义 表格提交数据
          if (recordset.updateRecords.length == 0 && recordset.insertRecords.length == 0 && recordset.removeRecords.length == 0) {
              this.$message({
                  message: "无数据更新！",
                  type: "info",
              });
              return;
          }
          var err = false;
          this.$nextTick(() => {
              this.targetSetSave(begindt, rpt_itemcode, recordset, selrow);
          });
      },
      //靶值数据保存到数据库
      targetSetSave(begindt, rpt_itemcode, recordset, selrow) {
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "tagetSetSave",
                      instrId: this.instrId,
                      qcid: selrow.qcid,
                      begindt: begindt,
                      rpt_itemcode: rpt_itemcode,
                      qcitemvalue: recordset,
                      mode: "2",
                  },
              })
              .then((response) => {
                  if (response.errcode == "1") {
                      this.targetSetDialogVisible = false;
                      this.getData();
                      //刷新 界面
                      // this.itemModeListChanged(selrow);
                      // this.$message({
                      //     message: "保存成功！",
                      //     type: "success",
                      // });
                  } else {
                      this.$message({
                          dangerouslyUseHTMLString: true,
                          message: "保存失败！<br/><br/>详细信息：" + response.errmsg,
                          type: "warning",
                      });
                  }
              });
      },
      targetSetDelete() {
          this.deleteRow(this.$refs.xTable62);
      },
      targetSetBegindtClose() {
          this.targetSetBegindt = "";
          this.targetSetBegindtDialogVisible = false;
      },
      targetSetClose() {
          this.targetSetDialogVisible = false;
      },
      //~~~~~~~~~~~~~~~~~~~~~~~~end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
      //显示帮助图片
      outcontrolshow() {
          this.outcontrolshowDlg = true;
      },
      handleCommand(name) {
          this.datename = name;
          if (name == "标本日期") this.daytype = "1";
          else if (name == "审核日期") this.daytype = "2";
          else if (name == "报告日期") this.daytype = "3";
      },
      InputMove() {
          if (this.allDataVisible == "1") {
              var row = this.$refs.xTableAll.getCurrentRow();
              if (row != null) this.$refs.xTableAll.setActiveRow(row, "displayvalue");
          }
      },
      checkMethod({ row }) {
          if (row.controlstatus == "0" && (row.outcontrolreason == "" || row.outcontrolreason == null)) {
              return false;
          } else {
              return true;
          }
      },
      openAddDlg() {
          this.bAddQcDataDlg = true;
          this.addQcData = [];
          this.adddataresultdt = new Date();
          this.adddatasign = 1;
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "qcsQuery",
                      instrId: this.instrId,
                      rpt_itemcode: this.rptitemcode,
                      queryDate1: this.queryDate[0],
                      queryDate2: this.queryDate[1],
                  },
              })
              .then((res) => {
                  this.addQcData = res;
                  setTimeout(() => {
                      this.$refs.addQc.setAllSelection(true);
                  }, 100);
              })
              .catch((e) => {
                  this.$alert(e, "出错");
              });
      },
      funAddQcData() {
          var selectrecords = this.$refs.addQc.getSelectRecords();
          var qcdate = XEUtils.toDateString(this.adddataresultdt, "yyyy-MM-dd");
          var nowdate = XEUtils.toDateString(this.adddataresultdt, "yyyy-MM-dd HH:mm:ss");
          selectrecords.forEach((e) => {
              var newrow = {};
              newrow.qcdate = qcdate;
              newrow.qcvaluesign = this.adddatasign;
              newrow.instrid = this.instrId;
              newrow.qclevel = e.levelno;
              newrow.rpt_itemcode = this.rptitemAllSelect;
              newrow.batchno = e.batchno;
              newrow.qcid = e.qcid;
              newrow.resultdt = nowdate;
              newrow.inuseflag = "1";
              newrow.drawflag = "1";
              newrow.checkflag = "0";
              newrow.lastmodifydt = nowdate;
              this.insertRowAtLast(this.$refs.xTableAll, newrow);
          });
          this.bAddQcDataDlg = false;
      },
      colformatter({ row, column, cellValue }) {
          if (XEUtils.toFixedString(cellValue, 4) == "0.0000") {
              return "";
          } else return cellValue;
      },
      //控制行的颜色
      rowClassName({ row, rowIndex }) {
          if (row.ischkflag == "1") return "row-blue";
          else return "";
      }, //控制列的颜色
      cellClassName({ row, column }) {
          let arr = ["itemname", "batchnof", "batchnob", "bias", "tea"];
          if (arr.includes(column.property)) {
              return "disabled-cell";
          } else if (column.property == "verifyflag") {
              if (row.verifyflag == "Y") return "col-green";
              else if (row.verifyflag == "N") return "col-pink";
              else return "";
          }
      },
      //失控处理验证
      OpenVerify() {
          this.bVerifyDlg = true;
          this.detObj.rptunitid = "";
          this.detObj.outinstrid = this.instrId;
          this.detObj.rpt_itemcode = this.rptitemcode;
          this.detObj.rptitemna = this.rptitemname + "[" + this.rptitemcode + "]";
          this.btndetQuery();
      },
      btndetQuery() {
          this.detObj.pxTableLoading = true;
          this.lotChangedetDialog = true;
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "alertDetInfo",
                      // inoutdetailid: this.curSelectRow.inoutdetailid,
                      qcdataid: this.tempqcdata.qcdataid,
                      ...this.detObj,
                      daytype: this.daytype, //标本日期(1) 审核日期(2)报告日期(3)
                  },
              })
              .then((res) => {
                  this.detObj.topTableData = res.topdata;
                  this.teaflag = res.teaflag;
                  if (res.leftdata.length > 0) this.detObj.plxTableData = res.leftdata.sort((a, b) => b.ischkflag - a.ischkflag);
                  else this.detObj.plxTableData = res.leftdata;
                  if (res.rightdata.length > 0) this.detObj.prxTableData = res.rightdata.sort((a, b) => b.ischkflag - a.ischkflag);
                  else this.detObj.prxTableData = res.rightdata;
                  this.detObj.pxTableLoading = false;
              })
              .catch((e) => {
                  this.detObj.pxTableLoading = false;
                  this.$alert(e, "出错");
              });
      },
      btndetSave() {
          var data = this.$refs.topTable.tableData;
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "Savedetinfo",
                      data: data,
                  },
              })
              .then((res) => {
                  if (res.errcode == "1") {
                      this.$pub.message(this, "保存成功", "success");
                      this.QueryTopData();
                      this.detObj.rptunitid = "";
                      this.lotChangedetDialog = true;
                  } else {
                      this.$alert(res.errmsg, "出错");
                  }
              })
              .catch((e) => {
                  this.$alert(e, "出错");
              });
      }, //刷新顶部信息
      QueryTopData() {
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "QueryTopData",
                      // inoutdetailid: this.curSelectRow.inoutdetailid,
                      qcdataid: this.tempqcdata.qcdataid,
                      ...this.detObj,
                  },
              })
              .then((res) => {
                  this.detObj.topTableData = res.topdata;
              })
              .catch((e) => {
                  this.$alert(e, "出错");
              });
      },
      //勾选项保存
      SaveSelectAppr() {
          let data = this.$refs.xTableBatchAppraise.getSelectRecords();
          if (!(data.length > 0)) return false;
          let urec = {
              insertRecords: data,
              removeRecords: [],
              updateRecords: [],
          };
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  timeout: 600000,
                  data: {
                      action: "saveselectappr",
                      urec: urec,
                  },
              })
              .then((res) => {
                  if (res.errcode == "1") {
                      this.$message({
                          message: "评价成功！",
                          type: "success",
                      });
                      this.batchaprrquery();
                  } else {
                      this.$alert(res.errmsg, "错误");
                  }
              })
              .catch((e) => {
                  this.$alert(error, "错误");
              });
      },
      //勾选
      chkflagChange(flag, row) {
          if (flag == "lx") {
              if (row.ischkflag == "1") {
                  let lrow = this.detObj.topTableData.find((m) => !m.reportidf);
                  if (!!lrow) {
                      lrow.reportidf = row.reportid;
                      lrow.samplenof = row.sampleno;
                      lrow.pat_no = row.pat_no;
                      lrow.pat_name = row.pat_name;
                      // lrow.result_strf = this.$tool.onlyNumber(row.result_str);
                      lrow.barcodef = row.barcode;
                      lrow.result_strf = row.result_str;
                      this.computedbias(lrow, "cp");
                  } else {
                      row.ischkflag = "0";
                      this.$alert("最多选择5个结果！", "提示");
                  }
              } else {
                  let lrow = this.detObj.topTableData.find((m) => m.reportidf == row.reportid);
                  if (!!lrow) {
                      lrow.reportidf = "";
                      lrow.samplenof = "";
                      lrow.pat_no = "";
                      lrow.pat_name = "";
                      lrow.result_strf = "";
                      lrow.barcodef = "";
                      this.computedbias(lrow, "cr");
                  }
              }
          } else {
              if (row.ischkflag == "1") {
                  let rrow = this.detObj.topTableData.find((m) => !m.reportidb);
                  if (!!rrow) {
                      rrow.reportidb = row.reportid;
                      rrow.samplenob = row.sampleno;
                      // rrow.result_strb = this.$tool.onlyNumber(row.result_str);
                      rrow.result_strb = row.result_str;
                      rrow.barcodeb = row.barcode;
                      this.computedbias(rrow, "cp");
                  } else {
                      row.ischkflag = "0";
                      this.$alert("最多选择5个结果！", "提示");
                  }
              } else {
                  let rrow = this.detObj.topTableData.find((m) => m.reportidb == row.reportid);
                  if (!!rrow) {
                      rrow.reportidb = "";
                      rrow.samplenob = "";
                      rrow.result_strb = "";
                      rrow.barcodeb = "";
                      this.computedbias(rrow, "cr");
                  }
              }
          }
      },
      computedbias(row, flag) {
          if (flag == "cp") {
              //计算
              if (!!row.result_strf && !!row.result_strb) {
                  if (this.teaflag == "0" || this.teaflag == "1") {
                      if (Number(row.result_strf) > 0) {
                          row.bias = (((Number(row.result_strb) - Number(row.result_strf)) / Number(row.result_strf)) * 100).toFixed(2);
                      }
                      if (!!row.bias && !!row.tea) {
                          if (Math.abs(Number(row.bias)) > Number(row.tea)) row.verifyflag = "N";
                          else row.verifyflag = "Y";
                      }
                  } else {
                      if (row.result_strf == row.result_strb) row.verifyflag = "Y";
                      else row.verifyflag = "N";
                  }
              }
          } else {
              //清除
              row.bias = "";
              row.verifyflag = "";
          }
      },
      //批量录入勾选框
      inputchk() {
          let data = this.$refs.xTableBatchAppraise.getSelectRecords();
          data.forEach((e) => {
              e.appraisetext = this.batchapprtext;
          });
      },
      //质控批量评价弹窗
      batchAppraise() {
          this.bBatchAppraiseDlg = true;
          this.batchqcid = "";
          this.batchapprtext = "";
          this.batchaprrquery();
      },
      //质控批量评价查询
      batchaprrquery() {
          this.bApprLoading = true;
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  timeout: 600000,
                  data: {
                      action: "batchaprrquery",
                      instrId: this.instrId,
                      batchapprdate: this.batchapprdate,
                      batchqcid: this.batchqcid,
                  },
              })
              .then((res) => {
                  this.bApprLoading = false;
                  this.batchAppraiseData = res;
                  // this.copyOutControlData = res;
              })
              .catch((e) => {
                  this.bApprLoading = false;
                  console.log(e);
              });
      },
      queryCopyOutControl() {
          this.copyOutControlData = [];
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  timeout: 600000,
                  data: {
                      action: "querycopyoutcontrol",
                      ...this.tempqcdata,
                      passhandle: this.passHandle,
                      sbatchotherlv: this.sBatchOtherLv,
                  },
              })
              .then((res) => {
                  this.copyOutControlData = res;
              })
              .catch((e) => {
                  console.log(e);
              });
      },
      //打开复制失控弹窗
      CopyOutControl() {
          this.queryCopyOutControl();
          this.bCopyOutControl = true;
      },
      //项目名CLASS
      ResultRowName({ row }) {
          if (row.titleflag == 1) {
              if (row.erromsg == "完成") return "chkok";
              else return "lackrule";
          }
      },
      //
      colspanMethod({ row, rowIndex, column, columnIndex, data }) {
          if (row.titleflag == 1) {
              if (column.property == "seq") {
                  return {
                      rowspan: 1,
                      colspan: 2,
                  };
              } else if (column.property == "errotype") {
                  return {
                      rowspan: 0,
                      colspan: 0,
                  };
              } else if (column.property == "erromsg") {
                  return {
                      rowspan: 1,
                      colspan: 1,
                  };
              }
          }
      },
      qccalcpre() {
          this.bQcCalcPreDlg = true;
      },
      setControlStatusNull() {
          this.bQcCalcPreDlg = false;
          this.listNullLogData = [];
          this.percentagenull = 0;
          this.bListSetNull = true;
          this.bClassLoading = false;
          this.listsetnull(this, this.tableDataRptitem, 0);
      },
      listsetnull(that, data, index) {
          this.bClassLoading = true;
          if (index < data.length) {
              let item = data[index];
              this.setnullloadingtxt = "正在重置" + "[" + item.itemcode_en + "]" + item.rpt_itemname;
              this.$tool
                  .request({
                      url: "LIS/LIS5/LIS530",
                      method: "post",
                      timeout: 600000,
                      data: {
                          action: "listqcsetnull",
                          queryDate1: this.queryDate[0],
                          queryDate2: this.queryDate[1],
                          instrId: this.instrId,
                          itemcodeen: item.itemcode_en,
                          rptitemname: item.rpt_itemname,
                          rptitemcode: item.rpt_itemcode,
                          qindex: index,
                          // Cols: Cols,
                      },
                  })
                  .then((res) => {
                      console.log("🤣  res", res);
                      if (res && res.length > 0) {
                          res.forEach((e) => {
                              this.listNullLogData.push(e);
                          });
                      }
                      this.percentagenull = parseInt((index / data.length) * 100);
                      if (this.bClassLoading) this.listsetnull(that, data, index + 1);
                  })
                  .catch((e) => {
                      console.log(e);
                  });
          } else {
              this.percentagenull = 100;
              if (data.length == index) {
              }
              this.bClassLoading = false;
              this.bStop2Flag = "1";
              console.log("结束");
          }
      },
      qccalc() {
          this.listLogData = [];
          this.percentage = 0;
          this.bListSetNull = false;
          this.bListQcCalc = true;
          this.bClassLoading = false;
          this.listqccalc(this, this.tableDataRptitem, 0);
      },
      listqccalc(that, data, index) {
          this.bClassLoading = true;
          if (index < data.length) {
              let item = data[index];
              this.loadingtxt = "正在审查" + "[" + item.itemcode_en + "]" + item.rpt_itemname;
              this.$tool
                  .request({
                      url: "LIS/LIS5/LIS530",
                      method: "post",
                      timeout: 600000,
                      data: {
                          action: "listqccalc",
                          queryDate1: this.queryDate[0],
                          queryDate2: this.queryDate[1],
                          instrId: this.instrId,
                          itemcodeen: item.itemcode_en,
                          rptitemname: item.rpt_itemname,
                          rptitemcode: item.rpt_itemcode,
                          qindex: index,
                          // Cols: Cols,
                      },
                  })
                  .then((res) => {
                      if (res && res.length > 0) {
                          res.forEach((e) => {
                              this.listLogData.push(e);
                          });
                      }
                      this.percentage = parseInt((index / data.length) * 100);
                      if (this.bClassLoading) this.listqccalc(that, data, index + 1);
                  })
                  .catch((e) => {
                      console.log(e);
                  });
          } else {
              this.percentage = 100;
              if (data.length == index) {
              }
              this.bClassLoading = false;
              this.bStop2Flag = "1";
              console.log("结束");
          }
      },
      //////////////////////////////////////事件/////////////////////////////////////////
      allbatch_change() {
          this.setLocalStorage();
          this.rptkey++;
          this.txtsearch = "";
          this.txtsearchbatch = "";
          this.$nextTick(() => {
              if (this.allbatch == "1") {
                  this.getRptitemList("");
              } else {
                  this.getBatchList();
              }
          });
      },
      setLocalStorage() {
          let jsondate = {
              allbatch: this.allbatch,
              showallbatch: this.showallbatch,
              gtype: this.gtype,
              //更多操作的选项先不添加了 避免误勾选后，找不到了。
              // slvshownum: this.slvshownum,
              // slvshowdiagnose: this.slvshowdiagnose,
          };
          let modListJson = JSON.stringify(jsondate);
          if (localStorage.getItem("rm_Qmod_OFF125") != "" && localStorage.getItem("rm_Qmod_OFF125") != null) localStorage.removeItem("rm_button_LIS530");
          localStorage.setItem("rm_button_LIS530", modListJson);
      },
      getLoccalStorage() {
          let obj = localStorage.getItem("rm_button_LIS530");
          if (obj != null && obj != "") {
              let jsondate = JSON.parse(obj);
              this.allbatch = jsondate.allbatch;
              this.showallbatch = jsondate.showallbatch;
              this.gtype = jsondate.gtype;
              // this.slvshownum = jsondate.slvshownum;
              // this.slvshowdiagnose = jsondate.slvshowdiagnose;
          }
      },
      //左边 rptitem窗口大小
      batchWindow_resize() {
          this.rptitemWindowHeight = this.$refs.lis530righttab.$el.offsetHeight - this.batchWindowHeight - 8;
      },

      //切换日期
      queryDate_change(type) {
          if (this.bCategory) this.categorytype = 1;
          else this.categorytype = 0;
          this.yq_change(this.instrId, this.instrName, type);
      },
      //切换仪器时
      yq_change(id, name, type) {
          this.instrId = id;
          this.instrName = name;
          this.floatwinlist = [];
          this.bShowUndecidedReson = false;
          this.qcoutcontroluser = "";
          this.qcoutcontrolusername = "";
          //if(type ==0) this.slvshownum = "0"; 
          this.getInputQcPower(); 
          this.initQclevel(type);
          this.getBatchList();
          this.getDefaultTxt();
          this.getpower();
      },
      getpower() {
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "getpower",
                      instrId: this.instrId,
                  },
              })
              .then((res) => {
                  if (res && res.option2102) {
                      this.option2102 = res.option2102 == "1" ? true : false;
                  } else this.option2102 = false;
              })
              .catch((error) => {
                  this.$alert(error, "错误");
                  this.option2102 = false;
              });
      },
      //水平切换
      qclevel_change() {
          this.getData();
      },
      //批号切换
      batch_change({ row }, event) {
          //console.log("event", event);
          //TODO ckj 此处欠功能：  切换批号时，项目保持不变
          if (this.allbatch == "0") this.getRptitemList(row.batchno);
      },
      // 勾选批号时
      batch_selectChange({ row }) {
          let batchno = this.getQueryBatch();
          this.getRptitemList(batchno);
      },
      //左边项目切换
      rptitem_change({ row }) {
          this.rptitemcode = row.rpt_itemcode;
          this.rptitemname = row.rpt_itemname;
          this.getData();
      },
      //右边标签切换
      tab_changed(tab, event) {
          var a = tab.value;
          if (tab.paneName == "0") {
              //图形
              this.$nextTick(() => {
                  this.charts.resize({
                      width: this.autoWidth,
                      height: this.autoHeight,
                  }); //可自适应 ;
              });
          }
          if (tab.paneName == "1") {
              //有效数据
              this.showDataKey++;
          }
          if (tab.paneName == "2") {
              //所有数据
              this.fullDataKey++;
          }
          if (tab.paneName == "3") {
              //质控评价数据 切换标签时强制渲染会导致刚输入的数据丢失。
              this.appraiseDataKey++;
          }
      },
      //所有项目数据标签中，项目下拉框切换
      rptitemAllSelect_change() {
          this.rptitemAllSelectChange(this.rptitemAllSelect, this.qclevelAllSelect);
      },
      allDate_change() {
          if (this.allDataVisible == "1") {
              this.rptitemAllSelect_change();
              // this.tableDataAll = XEUtils.clone(this.tableDataFull, true);
          }
          this.queryDateAll[0] = this.queryDate[0];
          this.queryDateAll[1] = this.queryDate[1];
          // this.starkey1++;
          // this.endkey2++;
          this.datekey++; 
      },
      //结果时间更改事件
      resultdtChange(val, row) {
          // console.log("🤣 ~ row", row);
          row.qcdate = XEUtils.toDateString(val, "yyyy-MM-dd");
          var qcdate = row.qcdate;
          var AddIndex = 0;
          var indexdata = this.$refs.xTableAll.getTableData().fullData.filter((item) => XEUtils.toDateString(item.qcdate, "yyyy-MM-dd") == qcdate);
          if (indexdata.length > 1) {
              XEUtils.sortBy(indexdata, ["qcvaluesign"]);
              AddIndex = indexdata[indexdata.length - 2].qcvaluesign - 0;
          } else {
              AddIndex = 0;
          }
          row.qcvaluesign = ++AddIndex;
      },
      //签名按钮
      qcsign_click() {
          if (this.instrId == 0) return false; //仪器校验

          this.qcsignDate[0] = this.queryDate[0]; //XEUtils.toDateString(new Date() - 7, "yyyy-MM-dd"); // 起始结束日期
          this.qcsignDate[1] = this.queryDate[1]; //XEUtils.toDateString(new Date(), "yyyy-MM-dd");
          this.qcsignDialogVisible = true;
          this.qcsignInit();
          this.getQcsignData();
      },
      outcontrol_click(row){
          this.tempqcdata = row;
          this.qcitem = {}; 
          this.getQCitem(row.qcdataid)
              .then((res) => {
                  this.qcitem.tagvalue = res.data.tagvalue;
                  this.qcitem.sd = res.data.sd;
                  this.qcitem.cv = res.data.cv;
                  this.qcitem.limithigh = res.data.limithigh;
                  this.qcitem.limitlow = res.data.limitlow;
                  this.outofcontrolvisible = true;
              })
              .catch(() => {
                  this.outofcontrolvisible = true;
              });
      },
      preqcsign() {
          console.log("🐮🍺Kanpai~this.qcsignloginflag", this.qcsignloginflag);
          if (this.qcsignloginflag == "0") {
              //按照登录用户
              this.qcsignuser = this.$tool.getSession(this.$tool.loginuserno);
              this.qcsignusername = this.$tool.getSession(this.$tool.loginusername);
              this.qcsign_click();
          } else if (this.qcsignloginflag == "1") {
              if (this.qcsignuser != "" && this.qcsignusername != "") {
                  this.qcsign_click();
              } else {
                  this.qcsign_loginUser();
              }
          } else this.qcsign_loginUser();
      },
      qcsign_loginUser() {
          this.qcsignuser = "";
          this.qcsignusername = "";
          //需要先登录程序
          this.$rm_Login({
              type: "签名登录验证",
              btn: {
                  confirmBtnText: "确定",
                  cancelBtnText: "取消",
              },
          })
              .then((res) => {
                  if (res.flag == "1") {
                      this.qcsign_click();
                      this.qcsignuser = res.userid;
                      this.qcsignusername = res.username;
                  } else {
                      //登录失败
                      this.qcsignuser = "";
                      this.qcsignusername = "";
                  }
              })
              .catch((e) => {
                  this.txtbarcode = "请先双击登录程序后再操作";
              });
      },
      qcout_loginUser(row) {
          this.qcoutcontroluser = "";
          this.qcoutcontrolusername = "";
          //需要先登录程序
          this.$rm_Login({
              type: "失控处理登录验证",
              btn: {
                  confirmBtnText: "确定",
                  cancelBtnText: "取消",
              },
          })
              .then((res) => {
                  if (res.flag == "1") {
                      this.outcontrol_click(row);
                      this.qcoutcontroluser = res.userid;
                      this.qcoutcontrolusername = res.username;
                  } else {
                      //登录失败
                      this.qcoutcontroluser = "";
                      this.qcoutcontrolusername = "";
                  }
              })
              .catch((e) => {
                  this.txtbarcode = "请先双击登录程序后再操作";
              });
      },
      //质控签名弹窗 退出按钮
      qcsignExit_click() {
          this.qcsignDialogVisible = false;
      },
      //质控签名弹窗 签名按钮
      qcsignCheck_click() {
          this.qcsignCheck();
      },
      //质控签名弹窗 取消签名按钮
      qcsignUnCheck_click() {
          this.qcsignUnCheck();
      },
      //质控签名弹窗 刷新按钮
      qcsignRefresh_click() {
          this.getQcsignData();
      },
      //质控签名弹窗 时间切换时
      qcsignDate_change() {
          this.$nextTick(() => {
              this.qcsignInit();
          });
      },
      //打印预览
      qcprint_preview_click() {
          this.printQcKey++;
          this.echartImg = this.getEcharImg();
          // this.echartImg = this.charts.getDataURL({
          //     type: "png",
          //     pixelRatio: 1.5, //放大两倍下载，之后压缩到同等大小展示。解决生成图片在移动端模糊问题
          //     backgroundColor: "#fff",
          // }); //获取到的是一串base64信息

          ////////////A4的大小是 width=650px, height=978px
          this.qcprint_qcdata();
          this.printDialogvisible = true;
      },
      //点击 打印按钮
      async qcprint_click() {
          this.printQcKey++;
          this.echartImg = this.getEcharImg();
          const res = await this.qcprint_qcdata();
          this.QcPrint();
      },
      qcPrintReport_click() {
          this.QcPrint();
      },

      //html打印，废弃，直接用框架打印
      //     printJS({
      //         printable: "printqcReport",
      //         type: "html",
      //         // header: "质控图",
      //         documentTitle: "质控图&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;", //打印标题 &ensp;
      //         targetStyles: ["*"] // 继承原来的所有样式
      //     });

      //////////////////////////////////////函数/////////////////////////////////////////////////

      //向框架发送数据 执行打印
      QcPrint() {
          this.printQcHeader[0] = this.hospitalname + "  质控图";
          // this.printQcFooter[0] = "操作者：";
          // this.printQcFooter[1] = "核对者：";
          // this.printQcFooter[2] = "主管签名：";
          this.printQcTilteText[0] = "仪器：" + this.instrName + "   日期区间：" + this.queryDate[0] + "~" + this.queryDate[1] + "   " + this.printQcFilecode + "   " + this.testmethod;
          this.printQcEndText[0] = "";
          var printAppraise = [];
          var printTableLinesOptions = [
              {
                  colname: "水平",
                  colwidth: 53,
                  colalign: 3,
              },
              {
                  colname: "批号",
                  colwidth: 108,
                  colalign: 1,
              },
              {
                  colname: "名称",
                  colwidth: 108,
                  colalign: 1,
              },
              {
                  colname: "靶值/均值",
                  colwidth: 80,
                  colalign: 2,
              },
              {
                  colname: "标准差",
                  colwidth: 75,
                  colalign: 2,
              },
              {
                  colname: "变异系数",
                  colwidth: 75,
                  colalign: 2,
              },
              {
                  colname: "有效期",
                  colwidth: 90,
                  colalign: 3,
              },
              {
                  colname: "数量",
                  colwidth: 46,
                  colalign: 2,
              },
              {
                  colname: "备注",
                  colwidth: 165,
                  colalign: 1,
              },
          ];
          if (this.qcOption.SHOWREAGENT == "1") {
              printTableLinesOptions = [
                  {
                      colname: "水平",
                      colwidth: 28,
                      colalign: 3,
                  },
                  {
                      colname: "批号",
                      colwidth: 65,
                      colalign: 1,
                  },
                  {
                      colname: "名称",
                      colwidth: 65,
                      colalign: 1,
                  },
                  {
                      colname: "靶值/均值",
                      colwidth: 60,
                      colalign: 2,
                  },
                  {
                      colname: "标准差",
                      colwidth: 50,
                      colalign: 2,
                  },
                  {
                      colname: "变异系数",
                      colwidth: 55,
                      colalign: 2,
                  },
                  {
                      colname: "有效期",
                      colwidth: 55,
                      colalign: 3,
                  },
                  {
                      colname: "数量",
                      colwidth: 28,
                      colalign: 2,
                  },
                  {
                      colname: "备注",
                      colwidth: 123,
                      colalign: 1,
                  },
                  {
                      colname: "试剂厂商",
                      colwidth: 55,
                      colalign: 1,
                  },
                  {
                      colname: "试剂批号",
                      colwidth: 60,
                      colalign: 1,
                  },
                  {
                      colname: "校准品厂商",
                      colwidth: 65,
                      colalign: 1,
                  },
                  {
                      colname: "校准品批号",
                      colwidth: 70,
                      colalign: 1,
                  },
              ];
          }
          var printTableOutcontrolOptions = [
              {
                  colname: "日期",
                  colwidth: 70,
                  colalign: 1,
              },
              {
                  colname: "水平",
                  colwidth: 53,
                  colalign: 3,
              },
              {
                  colname: "失控规则",
                  colwidth: 80,
                  colalign: 1,
              },
              {
                  colname: "失控原因",
                  colwidth: 123,
                  colalign: 1,
              },
              {
                  colname: "失控处理",
                  colwidth: 141,
                  colalign: 1,
              },
              {
                  colname: "处理结果",
                  colwidth: 123,
                  colalign: 1,
              },
              {
                  colname: "处理人",
                  colwidth: 70,
                  colalign: 3,
              },
              {
                  colname: "处理日期",
                  colwidth: 140,
                  colalign: 1,
              },
          ];
          var printTableAppraiseOptions = [
              {
                  colname: "评价日期",
                  colwidth: 108,
                  colalign: 3,
              },
              {
                  colname: "质控品",
                  colwidth: 80,
                  colalign: 3,
              },
              {
                  colname: "评价内容",
                  colwidth: 356,
                  colalign: 3,
              },
              {
                  colname: "操作时间",
                  colwidth: 148,
                  colalign: 3,
              },
              {
                  colname: "操作人",
                  colwidth: 108,
                  colalign: 3,
              },
          ];

          if (this.tableAppraiseData.length > 0) {
              printAppraise = this.tableAppraiseData;
              var username = "";
              printAppraise.forEach((e) => {
                  e.appraiseuser = e.appraiseusername;
                  if (e.rechkusername != "" && e.rechkusername != null) {
                      username = e.rechkusername;
                  }
              });
          }
          if (username != "" && this.printQcFooter.length > 2 && this.printQcFooter[2] == " ") {
              this.printQcFooter[2] = "主管签名：" + username;
          }
          var p = { printQcHeader: this.printQcHeader, printQcFooter: this.printQcFooter, printQcTilteText: this.printQcTilteText, printQcEndText: this.printQcEndText, pirntQcImg: this.echartImg, printTableLines: this.tableDataLines, printTableQcdata: this.tableDataPrintQcdata, printTableOutcontrol: this.tableDataOutcontrol, printTableOutcontrolOptions: printTableOutcontrolOptions, printTableAppraise: printAppraise, printTableAppraiseOptions: printTableAppraiseOptions, printTableLinesOptions: printTableLinesOptions, printHideAppraise: this.qcOption.HIDEAPPRAISE, printShowReagent: this.qcOption.SHOWREAGENT };
          if (typeof jsObj != "undefined") {
              //console.log(JSON.stringify(p));
              jsObj.ReadCard("printqc:" + JSON.stringify(p));
          } else {
              this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                  confirmButtonText: "确定",
              });
          }
      },
      //初始化查询窗口
      initQuery() {
          this.queryDate = ["", ""];
          let day1 = new Date(); //起始结束日期
          //7天前作为起始日期
          //this.queryDate[0] = XEUtils.toDateString(day1.setDate(day1.getDate() - 7), "yyyy-MM-dd");
          // this.queryDate[0] = XEUtils.toDateString(XEUtils.getWhatDay(new Date(), -180), "yyyy-MM-dd")
          this.queryDate[0] = XEUtils.toDateString(new Date(), "yyyy-MM-01");
          // this.queryDate[0] = "2020-08-11";
          this.queryDate[1] = XEUtils.toDateString(new Date(), "yyyy-MM-dd");
          this.queryDateAll[0] = this.queryDate[0];
          this.queryDateAll[1] = this.queryDate[1];
      },
      async getinstr() {
          try {
              const res = await this.$tool.request({
                  url: "ucent/ddl",
                  method: "post",
                  data: {
                      action: "instrument",
                  },
              });
              var instr = res.RData;
              instr.Data.forEach((e) => {
                  if (e.instrid == this.instrId) {
                      this.instrName = e.instrname;
                  }
              });
              this.getLoccalStorage();
          } catch (e) {
              this.$message.warning(e);
          }
      },
      //查询条件校验
      queryCheck() {
          let msg;
          msg = this.valid(this.instrId, "请选择仪器！"); //仪器校验
          if (msg) return false;
          msg = this.valid(this.queryDate[0], "开始日期 必须填写！"); //时间校验
          if (msg) return false;
          msg = this.valid(this.queryDate[1], "结束日期 必须填写！");
          if (msg) return false;

          return true;
      },
      //初始化结果界面
      resetData() {
          this.queryQclevel = [];
          this.queryQclevelEnable = [];
          this.qcOption = {};
          this.QC1_2SALTER = "";
          this.resetData1();
      },
      resetData1() {
          this.tableDataBatch = [];
          this.resetData2();
      },
      resetData2() {
          this.batchno = "";
          this.tableDataRptitem = [];
          this.rptitemAll = [];
          this.rptitemAllSelect = "";
          this.resetData3();
      },
      resetData3() {
          this.tableDataFull = [];
          this.monthNormalData = [];
          this.cumNormalData = [];
          this.tableDataShow = [];
          this.tableDataLines = [];
          this.tableDataLinesunion = [];
          this.tableAppraiseData = [];
          this.tableDataOutcontrol = [];
          this.drawpointData = [];
          this.qcsOption = [];
          this.tableDataAll = []; //所有项目数据
          this.qcrule = {};
          this.charts.clear(); //此处可清空原数据，或用 this.charts.setOption({option},true)
          this.drawTitleText = ""; //上面clear好像清空不了这个
          this.queryDateAll[0] = this.queryDate[0];
          this.queryDateAll[1] = this.queryDate[1];

          this.qclevelAllSelect = "";
          this.draw(); //画一个空的图形，避免白板
      },
      btnPrintData(type) {
          var printdata = [];
          // var printuser = this.$tool.getSession(this.$tool.loginusername);
          var colrow = { qcdate: "日期", seq: "序号", rptitem: this.rptitemname };
          for (var k = 0; k < this.queryQclevels.length; k++) {
              colrow["val" + k] = "测定值(" + this.queryQclevels[k].label + ")";
              colrow["sd" + k] = "SD(" + this.queryQclevels[k].label + ")";
          }
          printdata.push(colrow);
          for (var i = 0; i < this.tableDataShow.length; i++) {
              var currstr = {};
              currstr.qcdate = this.tableDataShow[i].qcdate;
              currstr.seq = this.tableDataShow[i].seq;
              // if (this.queryQclevels.length < 7) {
              //     for (var j = 0; j <= 6; j++) {
              if (this.queryQclevels.length < 13) {
                  for (var j = 0; j <= 12; j++) {
                      currstr["val" + j] = this.queryQclevels[j] && this.queryQclevels[j].value != "" && !XEUtils.isUndefined(this.queryQclevels[j].value) ? this.tableDataShow[i]["val" + this.queryQclevels[j].value] : "";
                      currstr["sd" + j] = this.queryQclevels[j] && this.queryQclevels[j].value != "" && !XEUtils.isUndefined(this.queryQclevels[j].value) ? this.tableDataShow[i]["sd" + this.queryQclevels[j].value] : "";
                  }
              }
              printdata.push(currstr);
          }
          var columns = [];
          for (let i = 0; i < 9; i++) {
              columns.push({ title: "项目", property: "rptitem" });
              columns.push({ title: "打印人", property: "printuser" });
              if (i == 0) {
                  columns.push({ title: "日期", property: "qcdate" });
              } else if (i == 1) {
                  columns.push({ title: "序号", property: "seq" });
              } else if (i > 1) {
                  columns.push({ title: "val" + (i - 2), property: "val" + (i - 2) });
                  columns.push({ title: "sd" + (i - 2), property: "sd" + (i - 2) });
              }
          }
          let str = JSON.stringify(columns);
          str += "\r";
          str += JSON.stringify(printdata);
          let sql = btoa(encodeURIComponent(str));
          //console.log("print", res.print, columns);
          if (type == "design") jsObj.SetCustomJsonPrintConfig("5066", sql, "admin", "LIS530");
          else if (type == "print") jsObj.PrintCustomJsonReport("5066", sql, "admin", "LIS530", "");
      },
      //刷新可使用的水平
      initQclevel(type) {
          if (this.queryCheck() === false) return;
          this.isqchelpouthanding = false;
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "initQclevel",
                      instrId: this.instrId,
                      queryDate1: this.queryDate[0],
                      queryDate2: this.queryDate[1],
                  },
              })
              .then((response) => {
                  var data = response.Data;
                  this.queryQclevels = [];
                  this.queryQclevel = [];
                  this.queryQclevelEnable = [];
                  this.qcOption = response.qcOption;
                  this.qcsignloginflag = this.qcOption.QCSIGNLOGINFLAG;
                  this.qcoutloginflag = this.qcOption.QCOUTLOGINFLAG;
                  if (this.qcOption.QCHELPOUTHANDING != "" && this.qcOption.QCHELPOUTHANDING != null) {
                      this.isqchelpouthanding = true;
                      this.outcontrolshowImg = this.qcOption.QCHELPOUTHANDING;
                  }
                  if (this.qcOption.HOSPITALNA != null && this.qcOption.HOSPITALNA != "") this.hospitalname = this.qcOption.HOSPITALNA;
                  else this.hospitalname = this.qcOption.HOSPITALNAME;
                  this.printQcFilecode = this.qcOption.QCPRINTFILECODE;
                  this.hideinstrqcval = this.qcOption.HIDEINSTRQCVAL == "1" ? true : false;
                  this.hidelastuserndt = this.qcOption.HIDELASTUSERNDT == "1" ? true : false;
                  var printcol = XEUtils.toNumber(this.qcOption.QCDATACOL);
                  var printrow = XEUtils.toNumber(this.qcOption.QCDATAROW);
                  if (printcol > 20) this.printQcdataLen = 20;
                  else if (printcol < 10) this.printQcdataLen = 10;
                  else this.printQcdataLen = printcol;
                  if (printrow > 5) this.printQcdataRow = 5;
                  else if (printrow < 1) this.printQcdataRow = 1;
                  else this.printQcdataRow = printrow;
                  if (this.qcOption.RENAMECURRENTCONTROL != "") this.renamecurrentcontrol = this.qcOption.RENAMECURRENTCONTROL;
                  else this.renamecurrentcontrol = "当前在控";
                  this.QC1_2SALTER = response.qcOption.QC1_2SALTER;
                  var QCPRINTFOOTTEXTGLOBAL = this.qcOption.QCPRINTFOOTTEXTGLOBAL; //从全局参数获取页尾的显示文
                  if (this.qcOption.QCXAXISINTERVAGLOBAL > 0) this.echartsAxisInterval = this.qcOption.QCXAXISINTERVAGLOBAL; //质控图的X轴，最多显示多少个日期
                  if (QCPRINTFOOTTEXTGLOBAL.trim().length > 0) {
                      let arr = QCPRINTFOOTTEXTGLOBAL.split(",");
                      this.printQcFooter[0] = "打印：" + arr[0];
                      if (arr[0]) this.printQcFooter[0] = "打印：" + arr[0];
                      if (arr[1] || arr[1] == "") {
                          if (arr[1] == "") {
                              this.printQcFooter[1] = " ";
                          } else {
                              this.printQcFooter[1] = this.$pub.cutText(arr[1], 24);
                          }
                      }
                      //  if (arr[2] && arr[2] != "") {
                      if (arr[2] || arr[2] == "") {
                          if (arr[2] == "") {
                              this.printQcFooter[2] = " ";
                          } else {
                              this.printQcFooter[2] = this.$pub.cutText(arr[2], 24);
                          }
                      }
                  } else {
                      this.printQcFooter[0] = "操作者：";
                      this.printQcFooter[1] = "核对者：";
                      this.printQcFooter[2] = "主管签名：";
                  }
                  for (var i = 0; i < data.length; i++) {
                      // this.queryQclevelEnable[i] = data[i].val;
                      // this.queryQclevel[i] = data[i].val;
                      let val = {
                          value: data[i].val,
                          label: data[i].na,
                      };
                      this.queryQclevels.push(val);
                      this.queryQclevelEnable.push(val);
                      this.queryQclevel.push(val.label);
                  }
              });
          // this.getDataByAjax(
          //     {
          //         url: "LIS/LIS5/LIS530",
          //         method: "post",
          //         data: {
          //             action: "initQclevel",
          //             instrId: this.instrId,
          //             queryDate1: this.queryDate[0],
          //             queryDate2: this.queryDate[1]
          //         }
          //     },
          //     "",
          //     "",
          //     data => {
          //         this.queryQclevels = [];
          //         this.queryQclevel = [];
          //         this.queryQclevelEnable = [];
          //         this.qcOption
          //         for (var i = 0; i < data.length; i++) {
          //             // this.queryQclevelEnable[i] = data[i].val;
          //             // this.queryQclevel[i] = data[i].val;
          //             let val = {
          //                 value: data[i].val,
          //                 label: data[i].na
          //             };
          //             this.queryQclevels.push(val);
          //             this.queryQclevelEnable.push(val);
          //             this.queryQclevel.push(val.label);
          //         }
          //         let a = 1;
          //     },
          //     data => {
          //         //errFunction
          //     }
          // );
      },
      //设定水平按钮是否允许使用
      setQclevelDisabled(qclevel) {
          for (var i = 0; i < this.queryQclevelEnable.length; i++) {
              if (this.queryQclevelEnable[i].value == qclevel.value) return false;
          }
          return true;
      },
      //根据所选levelname获取level 编号 queryQclevelCode[]
      getQclevelCode(qclevel) {
          this.queryQclevelCode = [];
          for (var i = 0; i < qclevel.length; i++) {
              for (var m = 0; m < this.queryQclevels.length; m++) {
                  if (this.queryQclevels[m].label == qclevel[i]) {
                      this.queryQclevelCode.push(this.queryQclevels[m].value);
                      continue;
                  }
              }
          }
      },
      //根据水平名称，转换为水平编码
      transtQclevel(qclevelName) {
          for (var i = 0; i < this.queryQclevelEnable.length; i++) {
              if (this.queryQclevelEnable[i].label == qclevelName) {
                  return this.queryQclevelEnable[i].value;
              }
          }
          return "";
      },
      //获取质控评价默认评价
      getDefaultTxt() {
          this.defaulttxt = "";
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "getdefaulttxt",
                      instrId: this.instrId,
                  },
              })
              .then((res) => {
                  this.defaulttxt = res;
                  if (res.defaulttxt && res.defaulttxt) this.defaulttxt = res.defaulttxt;
                  if (res.qcsdt) this.batchQcsOption = res.qcsdt;
              })
              .catch((error) => {
                  this.$alert(error, "错误");
              });
      },
      //获取左边质控批号列表
      getBatchList() {
          var old_batchno = "";
          if (this.$refs.xTableB) {
              var currentRow = this.$refs.xTableB.getCurrentRow();
              if (currentRow) {
                  old_batchno = currentRow.batchno;
              }
          }
          this.resetData1();
          if (this.queryCheck() === false) return;
          this.getDataByAjax(
              {
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "getBatchList",
                      instrId: this.instrId,
                      queryDate1: this.queryDate[0],
                      queryDate2: this.queryDate[1],
                      allbatch: this.allbatch, //0单批号、1多批号、2不分批号
                      showallbatch: this.showallbatch, //显示所有批号
                      showother: this.showother, //显示非累计点
                  },
              },
              "",
              "",
              (data) => {
                  this.tableDataBatch = data;
                  var findIndex = this.tableDataBatch.findIndex((item, index) => item.batchno == old_batchno);
                  if (findIndex > 0) {
                      this.$nextTick(() => {
                          let selectrow = this.$refs.xTableB.getData(findIndex);
                          this.$refs.xTableB.setCurrentRow(selectrow); //高亮行
                          this.$refs.xTableB.scrollToRow(selectrow); //滚动到行
                      });
                  } else {
                      this.loadFirstRow(this.$refs.xTableB, "");
                  }
                  // this.loadFirstRow(this.$refs.xTableB, "");
                  this.$nextTick(() => {
                      let batchno = this.getQueryBatch();
                      this.getRptitemList(batchno);
                  });
              },
              (data) => {
                  //errFunction
              }
          );
      },

      //获取用户选择的查询批号
      getQueryBatch() {
          //不分批号
          if (this.allbatch == "1") {
              return "";
          }
          //单批号
          else if (this.allbatch == "0") {
              var selrow = this.$refs.xTableB.getCurrentRow();
              if (selrow) {
                  return "" + selrow.batchno;
              } else return "-1";
          }
          //批号多选
          else if (this.allbatch == "2") {
              var selectRows = this.$refs.xTableB.getSelectRecords();
              if (selectRows && selectRows.length > 0) {
                  var batchno = "";
                  for (let index in selectRows) {
                      batchno += "," + selectRows[index].batchno;
                  }
                  return batchno.substring(1);
              } else {
                  return "-1";
              }
          }
      },
      //获取左边质控项目列表
      getRptitemList(batchno) {
          var old_rpt_itemcode = "";
          if (this.$refs.xTableR) {
              var currentRow = this.$refs.xTableR.getCurrentRow();
              if (currentRow) {
                  old_rpt_itemcode = currentRow.rpt_itemcode;
              }
          }
          this.resetData2();
          if (batchno == "-1") return;
          if (this.queryCheck() === false) return;

          this.getDataByAjax(
              {
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "getRptitemList",
                      instrId: this.instrId,
                      queryDate1: this.queryDate[0],
                      queryDate2: this.queryDate[1],
                      allbatch: this.allbatch, //0单批号、1不分批号、2批号多选
                      showallbatch: this.showallbatch, //显示所有批号
                      showother: this.showother, //显示非累计点
                      batchno: batchno,
                      qclevel: this.queryQclevelCode, //水平
                      checkflag: "all",
                  },
              },
              "",
              "",
              (data) => {
                  this.tableDataRptitem = data;
                  this.getRptitemAll(this.tableDataRptitem);
                  var findIndex = this.tableDataRptitem.findIndex((item, index) => item.rpt_itemcode == old_rpt_itemcode);
                  if (findIndex > 0) {
                      this.$nextTick(() => {
                          let selectrow = this.$refs.xTableR.getData(findIndex);
                          this.$refs.xTableR.setCurrentRow(selectrow); //高亮行
                          this.$refs.xTableR.scrollToRow(selectrow); //滚动到行
                      });
                  } else {
                      this.loadFirstRow(this.$refs.xTableR, "");
                  }
                  //this.loadFirstRow(this.$refs.xTableR, "");
                  this.$nextTick(() => {
                      var currentRow = this.$refs.xTableR.getCurrentRow();
                      if (currentRow) {
                          this.rptitemcode = currentRow.rpt_itemcode;
                          this.rptitemname = currentRow.rpt_itemname;
                          this.getData();
                      } else {
                          this.rptitemcode = "";
                          this.rptitemname = "";
                      }
                  });
              },
              (data) => {
                  //errFunction
              }
          );
      },
      //所有项目数据标签中，项目下拉框
      getRptitemAll(tableData) {
          this.rptitemAll = [];
          this.rptitemAllSelect = "";
          if (tableData && tableData.length > 0) {
              tableData.forEach((item) => {
                  let temp = {};
                  temp.key = item.rpt_itemcode;
                  temp.value = item.rpt_itemcode;
                  temp.label = item.rpt_itemname;
                  this.rptitemAll.push(temp);
              });
          }
      },
      //定义右边全部数据标签、签名弹窗中 ，特殊单元格颜色
      getOutcontrolClassname({ row, rowIndex, $rowIndex, column }) {
          if (column.property == "controlstatus" || column.property == "controlstatusna" || column.property == "cp_controlstatus" || column.property == "cp_controlstatusna") {
              if (row.controlstatus == "0") return "lis530outcontrol";
              if (row.controlstatus == null || row.controlstatus == "2") return "lis530outcontrolNull";
          } else if (["checkflag", "checkdt", "checkuser", "qcdate"].includes(column.property)) {
              //审核标记 审核人，审核日期， 质控日期，若审核过了，则变浅绿色
              if (row.checkflag == "1") return "lis530check";
          }
      },
      //定义右边：有效数据 标签中，失控单元格颜色
      getOutcontrolClassnameShow({ row, rowIndex, $rowIndex, column }) {
          if (column.property.substring(0, 2) == "sd") {
              if (row["controlstatus" + column.property.substring(2)] == "0") return "lis530outcontrol";
          } else if (column.property.substring(0, 3) == "val") {
              if (row["controlstatus" + column.property.substring(3)] == "0") return "lis530outcontrol";
          }
      },
      //以下为质控录入判断
      getInputQcPower() {
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "getInputQcPower",
                      instrId: this.instrId,
                  },
              })
              .then((res) => {
                  this.powRet = res;
              })
              .catch((error) => {
                  this.$alert(error, "错误");
              });
      },
      //打印表格的样式
      PrintClassName({ row, rowIndex, $rowIndex, column }) {
          if (row.hasOwnProperty("rowname")) {
              if (row.rowname == "日期") return "PrintClass PrintClassHeader";
          }
          if (column.property == "lineTagvalue" || column.property == "lineSd" || column.property == "lineCv") {
              return "PrintClass PrintClassRight";
          } else {
              return "PrintClass";
          }
      },
      PrintClassNameHeader({ row, rowIndex, $rowIndex, column }) {
          return "PrintClass PrintClassHeader";
      },
      //修改当前列计算结果
      CurrentDblClick({ row, column }) {
          if (row.checkflag == "已审核") {
              this.$alert("当前数据已经审核，不可修改!", "提示");
          } else {
              if (column.property == "calculatevalue") {
                  if (this.powRet == 0) {
                      this.$message({
                          type: "warning",
                          showClose: true,
                          message: "权限不足:缺少质控录入权限。",
                      });
                      return false;
                  }
                  this.tempqcdata = row;
                  this.oldqcdata = XEUtils.clone(this.tempqcdata, true);
                  this.qcupdatevalue = "";
                  this.qccalupdatevalue = null;
                  this.qccalupdatesd = null;
                  this.updatereason = "";
                  this.Valuedialogvisible = true;
              }
              if (column.property == "controlstatus" || column.property == "outcontroltips" || column.property == "cp_controlstatus" || column.property == "cp_controlstatusna" || column.property == "cp_outcontroltips") {
                  if (this.powRet == 0) {
                      this.$message({
                          type: "warning",
                          showClose: true,
                          message: "权限不足:缺少质控录入权限。",
                      });
                      return false;
                  }
                  this.preoutcontrol(row);
              }
              this.oldtempqcdata = XEUtils.clone(row, true);
          }
      },
      preoutcontrol(row){
          if(this.qcoutloginflag=="0")  {//按照登录用户
                  this.qcoutcontroluser =  this.$tool.getSession(this.$tool.loginuserno);
                  this.qcoutcontrolusername =  this.$tool.getSession(this.$tool.loginusername);
                  this.outcontrol_click(row);
          }else if(this.qcoutloginflag == "1"){
                  if(this.qcoutcontroluser !=""&&this.qcoutcontrolusername != "")
                  {
                            this.outcontrol_click(row);
                  }else{
                      this.qcout_loginUser(row);
                  }
          }else this.qcout_loginUser(row);
      },

      CalculateSave() {
          // if (XEUtils.isNull(this.qccalupdatesd) || XEUtils.isNull(this.qccalupdatevalue)) return;
          // if (!(Math.abs(this.qcupdatevalue) >= 0)) return; //判断是否为数值型
          if (!(Math.abs(this.qcupdatevalue) >= 0)) return; //判断是否为数值型
          // var oldqcdata = XEUtils.clone(this.tempqcdata, true);
          if (this.option2102 && this.qcupdatevalue != "" && (this.updatereason == "" || this.updatereason == null)) {
              this.$alert("请您填写修改原因。", "提示");
          } else {
              if (this.qcupdatevalue != "") {
                  this.tempqcdata.calculatevalue = this.qccalupdatevalue;
                  this.tempqcdata.displayvalue = this.tempqcdata.calculatevalue + "";
                  this.tempqcdata.calculatesd = this.qccalupdatesd;
              }
              this.SaveUpdate(this.oldqcdata, this.updatereason, "calc");
          }
      },
      //另存当日其他失控点
      SaveOtherUpdate() {
          let selectRecords = this.$refs.copyOutControlTable.getSelectRecords();
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "saveotherqcdata",
                      qcdata: this.tempqcdata,
                      selectrecords: selectRecords,
                      qcoutcontroluser:this.qcoutcontroluser,
                  },
              })
              .then((res) => {
                  if (res.errcode == "1") {
                      this.$message({
                          message: "修改成功！",
                          type: "success",
                      });
                      this.Valuedialogvisible = false;
                      this.bCopyOutControl = false;
                      this.outofcontrolvisible = false;
                      this.updatereason = "";
                      this.getData(); //修改成功后刷新整个页面
                  } else {
                      this.$alert(res.errmsg, "错误");
                  }
              })
              .catch((error) => {
                  this.$alert(error, "错误");
              });
      },
      SaveUpdate(oldqcdata, reason, savetype) {
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "saveqcdata",
                      qcdata: this.tempqcdata,
                      oldqcdata: oldqcdata,
                      reason: reason,
                      savetype: savetype,
                      qcoutcontroluser:this.qcoutcontroluser,
                  },
              })
              .then((res) => {
                  if (res.errcode == "1") {
                      this.$message({
                          message: "修改成功！",
                          type: "success",
                      });
                      this.Valuedialogvisible = false;
                      this.outofcontrolvisible = false;
                      this.updatereason = "";
                      this.getData(); //修改成功后刷新整个页面
                  } else {
                      this.$alert(res.errmsg, "错误");
                      this.tempqcdata = XEUtils.clone(oldqcdata, true);
                  }
              })
              .catch((error) => {
                  this.$alert(error, "错误");
                  this.tempqcdata = XEUtils.clone(oldqcdata, true);
              });
      },
      //计算修改后的计算结果和SD
      Calcnew(val) {
          if (val === "" || val == null) {
              this.qccalupdatesd = 0;
              this.qccalupdatevalue = 0;
          }
          if (!isNaN(val)) {
              var sd = this.tempqcdata.sd;
              if (sd == "" || sd == null || sd == 0) {
                  this.qccalupdatevalue = parseFloat(val);
                  this.qccalupdatesd = "";
              } else {
                  this.qccalupdatevalue = parseFloat(val);
                  var tagvalue = this.tempqcdata.tagvalue;
                  var sdvalue = (val - 0 - (tagvalue - 0)) / (sd - 0);
                  this.qccalupdatesd = sdvalue.toFixed(5);
              }
          } else {
              this.qccalupdatesd = 0;
              this.qccalupdatevalue = 0;
          }
      },
      OutControlSave() {
          this.SaveUpdate(this.oldtempqcdata, "LIS530", "out");
          if (this.tempqcdata.controlstatus == "0") {
              if (this.outcontroloperation) {
                  this.parentflag = "2";
              } else {
                  this.parentflag = "1";
              }
          } else {
              if (this.outcontroloperation) {
                  this.parentflag = "3";
              } else {
                  this.parentflag = "0";
              }
          }
      },
      getQCitem(qcdataid) {
          return new Promise((s, f) => {
              this.$tool
                  .request({
                      url: "LIS/LIS5/LIS530",
                      method: "post",
                      data: {
                          action: "querytagvalues",
                          qcdataid: qcdataid,
                      },
                  })
                  .then((res) => {
                      if (res.errcode == "1") {
                          s(res);
                      } else {
                          f(res);
                      }
                  })
                  .catch((error) => {
                      f(error);
                  });
          });
      },
      getAdvice() {
          return new Promise((s, f) => {
              this.$tool
                  .request({
                      url: "LIS/LIS5/LIS530",
                      method: "post",
                      data: {
                          action: "querytagvalues",
                          qcdataid: qcdataid,
                      },
                  })
                  .then((res) => {
                      if (res.errcode == "1") {
                          s(res);
                      } else {
                          f(res);
                      }
                  })
                  .catch((error) => {
                      f(error);
                  });
          });
      },
      AdviceClick({ row }) {
          if (this.advicetxt.indexOf(row.txtinfo) == -1) {
              if (this.appendChangeRow) {
                  this.advicetxt += "\n" + row.txtinfo;
              } else {
                  if (this.advicetxt) {
                      this.advicetxt += "," + row.txtinfo;
                  } else {
                      this.advicetxt += row.txtinfo;
                  }
              }
          }
      },
      AdvicedblClick({ row }) {
          this.advicetxt = row.txtinfo;
      },
      AdviceSubmit() {
          switch (this.infortype) {
              case 0:
                  this.tempqcdata.outcontrolreason = this.advicetxt;
                  break;
              case 1:
                  this.tempqcdata.outcontroloperation = this.advicetxt;
                  break;
              case 2:
                  this.tempqcdata.outcontrolresult = this.advicetxt;
                  break;
              case 3:
                  this.tempqcdata.cliniceffect = this.advicetxt;
                  break;
              case 4:
                  this.tempqcdata.premunition = this.advicetxt;
                  break;
              case 5:
                  if (this.tempappraise) this.tempappraise.appraisetext = this.advicetxt;
                  else this.tempqcdata.comments = this.advicetxt;
                  break;
              case 6: 
                  if (this.tempappraise) this.tempappraise.rechktext = this.advicetxt;
                  else this.tempqcdata.comments = this.advicetxt;
                  break;
              case 7:
                  this.batchapprtext = this.advicetxt;
                  break;
              default:
                  break;
          }
          this.dialogAdviceVisible = false;
      },
      ShowAdvice(infortype, row) {
          return new Promise((s, f) => {
              this.loadingAdvice = true;
              this.infortype = infortype;
              if (!row) this.tempappraise = "";
              this.$tool
                  .request({
                      url: "LIS/LIS5/LIS530",
                      method: "post",
                      data: {
                          action: "querytxtinfo",
                          instrid: this.instrId,
                          infotype: infortype == 99 ? 5 : infortype,
                      },
                  })
                  .then((res) => {
                      if (res.data) {
                          this.tableDataAdviceall = res.data;
                          this.tableDataAdvice = res.data;
                          this.txtinfoarr = [{ txtinfokind: "全部" }];
                          for (let i = 0; i < res.kinds.length; i++) {
                              this.txtinfoarr.push(res.kinds[i]);
                          }

                          this.txtkind = "全部";
                          this.advicetxt = "";
                          this.dialogAdviceVisible = true;
                          this.$nextTick(() => {
                              this.$refs.txtinfokind.setCurrentRow(this.$refs.txtinfokind.getData(0));
                          });
                      }
                      switch (infortype) {
                          case 0:
                              this.advicetxt = this.tempqcdata.outcontrolreason;
                              break;
                          case 1:
                              this.advicetxt = this.tempqcdata.outcontroloperation;
                              break;
                          case 2:
                              this.advicetxt = this.tempqcdata.outcontrolresult;
                              break;
                          case 3:
                              this.advicetxt = this.tempqcdata.cliniceffect;
                              break;
                          case 4:
                              this.advicetxt = this.tempqcdata.premunition;
                              break;
                          case 5:
                              if (row) {
                                  this.tempappraise = row;
                                  this.advicetxt = row.appraisetext;
                              } else this.advicetxt = this.tempqcdata.comments;
                              break;
                          case 6: 
                              if (row) {
                                  this.tempappraise = row;
                                  this.advicetxt = row.rechktext;
                              } else this.advicetxt = this.tempqcdata.comments;
                              break;
                          case 7: 
                              this.advicetxt = this.batchapprtext;
                          default:
                              break;
                      }
                      this.loadingAdvice = false;
                  })
                  .catch((error) => {
                      this.loadingAdvice = false;
                      f(error);
                  });
          });
      },
      infochange({ row }) {
          if (row.txtinfokind == "全部") {
              this.tableDataAdvice = this.tableDataAdviceall;
          } else {
              this.tableDataAdvice = this.tableDataAdviceall.filter((item) => item.txtinfokind == row.txtinfokind);
          }
      },
      //质控评价 current-change
      AppraiseChange({ row }) {},
      //获取定性质控对应的Y轴刻度
      getItemjudgeValue(displayvalue) {
          for (var i = 0; i < this.qcrule.itemjudge.length; i++) {
              if (displayvalue == this.qcrule.itemjudge[i].result_str) {
                  return this.qcrule.itemjudge.length - this.qcrule.itemjudge[i].seq / 10;
                  //return this.qcrule.itemjudge[i].seq / 10;
              }
          }
          return 0;
      },
      //获取右边列表所有数据
      getData() {
          this.bShowUndecidedReson = false;
          this.floatwincnt = 0;
          this.floatwinlist = [];
          this.resetData3();
          if (this.queryCheck() === false) return;
          if (!(this.instrId > 0)) {
              return this.$message({ message: "请选择仪器", type: "warning" });
          }
          let batchno = this.getQueryBatch();
          if (batchno == "-1") {
              return;
          }
          if (this.valid(XEUtils.isNull(this.rptitemcode), "请选择项目")) return msg;
          this.getFullData(batchno);
      },

      getFullData(batchno) {
          this.getQclevelCode(this.queryQclevel);
          this.testmethod = "";
          this.loading = true;
          this.batchno = batchno;
          this.floatwinlist = [];
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "getFullData",
                      instrId: this.instrId,
                      queryDate1: this.queryDate[0],
                      queryDate2: this.queryDate[1],
                      allbatch: this.allbatch, //0单批号、1不分批号、2批号多选
                      showallbatch: this.showallbatch, //显示所有批号
                      showother: this.showother, //显示非累计点
                      qclevel: this.queryQclevelCode, //水平
                      batchno: batchno,
                      rptitemcode: this.rptitemcode,
                      checkflag: "all",
                  },
              })
              .then((response) => {
                  if (response.errcode == "1") {
                      this.monthNormalData = response.mdata;
                      this.cumNormalData = response.cumdata;
                      this.printcheck = response.printcheck;
                      this.tableDataFull = response.Data;
                      if (this.qcOption.QCDYNAMICTAGSHOWACCU != "1") {
                          this.tableDataFull.forEach((e) => {
                              if (e.controlstatus == "2") {
                                  e.calculatesd = null;
                              }
                          });
                      }
                      var tempcalcRtn = response.calcRtn;
                      // console.log("🤣 ~ tempcalcRtn", tempcalcRtn);
                      this.floatwincnt = "";
                      this.floatwinmsg = "";
                      if (tempcalcRtn) {
                          this.floatwincnt = tempcalcRtn.Item1;
                          var templist = [];
                          for (var i = 0; i < tempcalcRtn.Item3.length; i++) {
                              var p = {
                                  seq: i + 1,
                                  erromsg: tempcalcRtn.Item3[i].erromsg,
                                  errotype: tempcalcRtn.Item3[i].errotype,
                              };
                              templist.push(p);
                          }
                          this.floatwinlist = templist;
                          // tempcalcRtn.Item3.forEach(e => {
                          //     this.floatwinmsg +=e+"\n";
                          // });
                          if (this.floatwinlist.length > 0 && this.slvshowdiagnose == "1") this.bShowUndecidedReson = true;
                      }
                      // if (this.tableDataFull != null && this.tableDataFull.length > 0) {
                      //     var msg = "";
                      //     this.tableDataFull.forEach((e) => {
                      //         if (e.controlstatus == null && e.inuseflag == "1") msg += "<br/>质控结果ID:" + e.qcdataid + ",批号:" + e.batchno + ",水平:" + e.qclevel + ",结果时间:" + e.resultdt;
                      //     });
                      //     if (msg != "") {
                      //         this.$message({
                      //             dangerouslyUseHTMLString: true,
                      //             message: "当前存在无法判定的点：" + msg,
                      //             type: "warning",
                      //             duration: 2,
                      //             width: 700,
                      //         });
                      //     }
                      // }
                      this.allDataVisible = "0";
                      this.rptitemAllSelect = this.rptitemcode;
                      this.qcrule = response.qcrule;
                      if (this.qcrule.qcrule == "1") {
                          this.qcrule.qcrule = "";
                          this.$alert(this.queryDate[0] + " 无质控规则，请调整日期或维护质控规则。", "质控图质控规则显示");
                      }
                      this.showmonthincontrol = response.showmonthincontrol;
                      this.showcumcontrol = response.showcumcontrol;
                      this.qcrule.itemjudge = XEUtils.sortBy(this.qcrule.itemjudge, ["seq"]);
                      this.qcshowmaxcv = response.qcshowmaxcv == "0" ? false : true;
                      if (this.qcshowmaxcv) {
                          this.drawTitleText = "质控项目：" + response.qcitem.rpt_itemname + "[" + response.qcitem.unit + "]    允许最大CV：" + response.qcitem.qccv + "\n质控规则：" + this.qcrule.qcrule;
                      } else this.drawTitleText = "质控项目：" + response.qcitem.rpt_itemname + "[" + response.qcitem.unit + "]   " + "\n质控规则：" + this.qcrule.qcrule;

                      this.tableAppraiseData = response.appraiseData;

                      this.$nextTick(() => {
                          this.getTableDataShow();
                      });
                      this.splitLineColor = response.lineColor;
                      this.testmethod = response.testmethod;
                  }
              });

          this.loading = false;
      },

      //// 处理 有效数据标签 （this.tableDataShow 数据）
      getTableDataShow() {
          this.setLocalStorage();
          this.tableDataShow = [];
          //this.tableDataLines = [];
          var tableDataShowTemp = []; //中转下，避免一直渲染
          var lineName = "";
          var lineNameOld = "";
          var lineIndex = 0;
          var index = 0;
          var dataCnt = 0;
          var newLine = false;
          var changeBatch = 0;
          for (var i = 0; i < this.tableDataFull.length; i++) {
              // //获取质控评价的qcid
              let findQcid = this.qcsOption.findIndex((item, index) => item.value == this.tableDataFull[i].qcid);
              if (findQcid == -1) {
                  this.qcsOption.push({
                      value: this.tableDataFull[i].qcid,
                      label: this.tableDataFull[i].batchno + " (" + this.tableDataFull[i].qclevel + ") " + this.tableDataFull[i].qcname + " [" + this.tableDataFull[i].qcid + "]",
                  });
              }
              //获取失控数据  tableDataOutcontrol
              if (this.tableDataFull[i].controlstatus == "0") {
                  let tmp = {};
                  tmp.qcdate = this.tableDataFull[i].qcdate;
                  tmp.qclevel = this.tableDataFull[i].qclevel;
                  tmp.outcontroltips = this.tableDataFull[i].outcontroltips;
                  tmp.outcontrolreason = this.tableDataFull[i].outcontrolreason;
                  tmp.outcontroloperation = this.tableDataFull[i].outcontroloperation;
                  tmp.outcontrolresult = this.tableDataFull[i].outcontrolresult;
                  tmp.outtransokresult = this.tableDataFull[i].outtransokresult;
                  tmp.outcontroluser = this.tableDataFull[i].outcontroluser;
                  tmp.outcontroloperatedt = this.tableDataFull[i].outcontroloperatedt;
                  this.tableDataOutcontrol.push(tmp);
              }

              let nextdata = false;
              if (this.tableDataFull[i].controlstatus == null && this.tableDataFull[i].drawflag != "1") continue;
              if (this.qcrule.qcruletype != "4") {
                  if (this.tableDataFull[i].qcitemvalueid == null || this.tableDataFull[i].qcitemvalueid <= 0) continue;
              }
              if (this.tableDataFull[i].drawflag != "1") continue;
              //if (this.tableDataFull[i].inuseflag != "1") continue;
              //if (this.tableDataFull[i].drawflag != "1") continue;
              lineIndex = this.tableDataFull[i].qclevel;
              lineName = "水平" + lineIndex; //lineName内部识别符号，界面不显示
              if (lineName != lineNameOld) {
                  // if (index >= 6) break; // index 取值范围为 1-6
                  if (index >= 12) break; // index 取值范围为 1-6
                  //index 应该可以扩展为无穷数据，但是必须要扩充线条颜色和表示符号，待做。
                  index++;
                  lineNameOld = lineName;

                  dataCnt = 1;
                  newLine = true;
                  changeBatch = 0;
              } else {
                  newLine = false;
                  dataCnt++; //统计数量
              }

              var qcdate = XEUtils.toDateString(this.tableDataFull[i].qcdate, "yyyy-MM-dd");
              var findIndex = -1;
              var seq = 1;
              var findRow;
              while (findIndex >= -1) {
                  //seq排序赋值
                  findIndex = tableDataShowTemp.findIndex(
                      (item, index) => item.qcdate == qcdate && index > findIndex //findIndex示例 ckj
                  );

                  if (findIndex == -1) {
                      findRow = {};
                      findRow.qcdate = qcdate;
                      findRow.seq = seq;
                      findRow.level = [];

                      tableDataShowTemp.push(findRow);
                      break;
                  } else {
                      findRow = tableDataShowTemp[findIndex];
                  }
                  var value = tableDataShowTemp[findIndex]["val" + lineIndex];
                  if (this.gtype == "0") {
                      seq++;
                      if (value == null) break;
                      if (findIndex + 1 == tableDataShowTemp.length) {
                          findRow = {};
                          findRow.qcdate = qcdate;
                          findRow.seq = seq;
                          findRow.level = [];
                          tableDataShowTemp.push(findRow);
                          break;
                      }
                  } else if (this.gtype == "1") {
                      break;
                  } else if (this.gtype == "2") {
                      if (Math.abs(this.tableDataFull[i].calculatesd) >= Math.abs(findRow["sd" + lineIndex])) {
                          nextdata = true;
                      }
                      break;
                  }
              }
              if (nextdata) continue;

              if (
                  //去重
                  findRow.level.findIndex((value) => value == this.tableDataFull[i].qclevel) == -1
              ) {
                  findRow.level.push(this.tableDataFull[i].qclevel);
              }
              findRow["val" + lineIndex] = parseFloat(this.tableDataFull[i].calculatevalue); //XEUtils.toFixedString(this.tableDataFull[i].calculatevalue, 4);
              findRow["sd" + lineIndex] = parseFloat(this.tableDataFull[i].calculatesd); //XEUtils.toFixedString(this.tableDataFull[i].calculatesd, 4);
              if (findRow["val" + lineIndex] != 0) {
                  // findRow["cv" + lineIndex] = parseFloat(XEUtils.toFixedString((findRow["sd" + lineIndex] * 100) / findRow["val" + lineIndex], 4));
                  findRow["cv" + lineIndex] = XEUtils.toFixedString(parseFloat(this.tableDataFull[i].cp_calculatecv), 4);
              } else {
                  findRow["cv" + lineIndex] = null;
              }
              if (this.qcrule.qcruletype == "4") {
                  let displayvalue = this.tableDataFull[i].displayvalue;
                  let seq = this.getItemjudgeValue(displayvalue) + 1;
                  if (seq > 0) {
                      findRow["val" + lineIndex] = displayvalue;
                      findRow["sd" + lineIndex] = seq;
                  }
              }
              findRow["display" + lineIndex] = this.tableDataFull[i].displayvalue;
              findRow["rowid" + lineIndex] = this.tableDataFull[i].qcdataid;
              findRow["checkuser" + lineIndex] = this.tableDataFull[i].checkuser;
              findRow["inuse" + lineIndex] = this.tableDataFull[i].inuseflag;
              findRow["time" + lineIndex] = XEUtils.toDateString(this.tableDataFull[i].resultdt, "yyyy-MM-dd HH:mm:ss");
              findRow["qcitemvalueid" + lineIndex] = this.tableDataFull[i].qcitemvalueid;
              findRow["itemvaluesd" + lineIndex] = parseFloat(this.tableDataFull[i].sd); //XEUtils.toFixedString(this.tableDataFull[i].sd, 4);
              findRow["itemvaluecv" + lineIndex] = parseFloat(this.tableDataFull[i].cv); //XEUtils.toFixedString(this.tableDataFull[i].cv, 4);
              findRow["qcname" + lineIndex] = this.tableDataFull[i].qcname;
              findRow["batchno" + lineIndex] = this.tableDataFull[i].batchno;
              findRow["tagvalue" + lineIndex] = this.tableDataFull[i].tagvalue;
              findRow["expriedt" + lineIndex] = XEUtils.toDateString(this.tableDataFull[i].expriedt, "yyyy-MM-dd");
              findRow["qcdate" + lineIndex] = XEUtils.toDateString(this.tableDataFull[i].qcdate, "yyyy-MM-dd");
              findRow["controlstatus" + lineIndex] = this.tableDataFull[i].controlstatus;
              findRow["outcontroltips" + lineIndex] = this.tableDataFull[i].outcontroltips;
              findRow["cp_controlstatus" + lineIndex] = this.tableDataFull[i].cp_controlstatus;
              findRow["cp_outcontroltips" + lineIndex] = this.tableDataFull[i].cp_outcontroltips; //失控点 失控/警告提示
              findRow["outcontrolreason" + lineIndex] = this.tableDataFull[i].outcontrolreason; // 失控原因
              findRow["outcontroloperation" + lineIndex] = this.tableDataFull[i].outcontroloperation; // 失控处理
              findRow["outcontrolresult" + lineIndex] = this.tableDataFull[i].outcontrolresult; // 处理结果
              findRow["outtransokresult" + lineIndex] = this.tableDataFull[i].outtransokresult; // 修正结果
              findRow["comments" + lineIndex] = this.tableDataFull[i].comments; // 微帮助信息
              findRow["comm" + lineIndex] = this.tableDataFull[i].comm;
              findRow["reagentmnfcturname" + lineIndex] = this.tableDataFull[i].reagentmnfcturname; //试剂厂商
              findRow["reagentbatchno" + lineIndex] = this.tableDataFull[i].reagentbatchno; //试剂批号
              findRow["calibratemnfcturname" + lineIndex] = this.tableDataFull[i].calibratemnfcturname; //校准品厂商
              findRow["calibrateno" + lineIndex] = this.tableDataFull[i].calibrateno; //校准品批号
              findRow["reagentvendorname" + lineIndex] = this.tableDataFull[i].reagentvendorname; //试剂供应商
              findRow["calibratevendorname" + lineIndex] = this.tableDataFull[i].calibratevendorname; //校准品供应商
              ////非累计， 仅画图的点
              let point1 = [];
              if (this.tableDataFull[i].inuseflag != "1") {
                  let xname = qcdate.substring(5) + (findRow.seq > 1 ? "(" + findRow.seq + ")" : "");
                  // //设点
                  // if(1 == 1 )
                  // {
                  //     xname = qcdate.substring(5) ;
                  // }
                  if (this.qcrule.qcruletype == "4") {
                      point1[0] = xname;
                      point1[1] = this.tableDataFull[i].displayvalue;
                  } else {
                      point1[0] = xname;
                      // 修改点的画图y坐标轴最大值
                      this.tableDataFull[i].calculatesd;
                      if (this.tableDataFull[i].calculatesd > 3.7) {
                          point1[1] = 3.7;
                      } else if (this.tableDataFull[i].calculatesd < -3.7) {
                          point1[1] = -3.7;
                      } else {
                          point1[1] = this.tableDataFull[i].calculatesd;
                      }
                      // point1[1] = Math.abs(this.tableDataFull[i].calculatesd) > 3.7 ? 3.7 : this.tableDataFull[i].calculatesd;
                  }
                  let pointIndex = this.drawpointData.findIndex((item, index) => item.qclevel == this.tableDataFull[i].qclevel);
                  if (!(pointIndex > 0)) {
                      let item = {};
                      item.qclevel = this.tableDataFull[i].qclevel;
                      item.controlstatus = this.tableDataFull[i].controlstatus;
                      item.data = [];
                      this.drawpointData.push(item);
                      pointIndex = this.drawpointData.length - 1;
                  }
                  this.drawpointData[pointIndex].data.push(point1);
              }
              ////
          }
          tableDataShowTemp = XEUtils.sortBy(tableDataShowTemp, ["qcdate", "seq"]);
          this.tableDataShow = tableDataShowTemp;
          //for (var i = 0; i < this.tableDataShow.length; i++) {}
          //单水平单批号时Y轴显示数值
          // if (this.qcOption.SINGLELEVELSHOWNUM == "1" && this.tableDataShow.length > 0 && index == 1) {
          if (this.slvshownum == "1" && this.allbatch == "0" && this.tableDataShow.length > 0 && index == 1) {
              this.singlelevelshownum.tagvalue = tableDataShowTemp[0]["tagvalue" + lineIndex];
              this.singlelevelshownum.sd = tableDataShowTemp[0]["itemvaluesd" + lineIndex];
          }
          this.draw(); //画图
      },

      //画图时工具，定义线条参数
      getDrawLine(dayLine, lines) {
          for (var i = 0; i < lines.length; i = i + 2) {
              label: {
                  if (dayLine) {
                      for (var m = 0; m < dayLine.level.length; m++) {
                          let qclevel = dayLine.level[m];
                          if (lines[i].namecode == qclevel) {
                              //lines[i].data.push(dayLine["sd" + qclevel]); //定义线条数据
                              let dataTemp = {};
                              let valueTrue = dayLine["sd" + qclevel];
                              dataTemp.qcdate = dayLine.qcdate;
                              dataTemp.value = valueTrue;
                              // 出4SD后，按4SD画点
                              if (valueTrue > 3.7 && this.qcrule.qcruletype != "4") {
                                  dataTemp.value = 3.7;
                              } else if (valueTrue < -3.7) {
                                  dataTemp.value = -3.7;
                              }
                              //非累计点 设置为空
                              if (dayLine["inuse" + qclevel] != "1") dataTemp.value = "";
                              dataTemp.valueTrue = dayLine["inuse" + qclevel] == "1" ? dayLine["sd" + qclevel] : ""; //记录真实值，提示框 tip时用
                              dataTemp.cp_controlstatus = dayLine["cp_controlstatus" + qclevel];
                              dataTemp.cp_outcontroltips = dayLine["cp_outcontroltips" + qclevel];
                              dataTemp.name = "";
                              if (this.qcrule.qcruletype != "4" && this.qcrule.qcruletype != "4" && Math.abs(Number(valueTrue)) >= 2 && Math.abs(Number(valueTrue)) < 3) {
                                  //进入2S区域，先用红色空心表示
                                  dataTemp.symbolSize = 12;
                                  if (dataTemp.symbol == "circle") {
                                      dataTemp.symbol = "emptyCircle"; //0圆_节
                                  } else if (dataTemp.symbol == "triangle") {
                                      dataTemp.symbol = "emptyTriangle"; //△三角
                                  } else if (dataTemp.symbol == "triangle") {
                                      dataTemp.symbol = "emptyRoundRect"; //□圆角矩形_节点标记
                                  } else if (dataTemp.symbol == "triangle") {
                                      dataTemp.symbol = "emptyDiamond"; //◇钻石_节点标记
                                  } else if (dataTemp.symbol == "triangle") {
                                      dataTemp.symbol = "emptyPin"; //○饼图_节点标记
                                  } else if (dataTemp.symbol == "triangle") {
                                      dataTemp.symbol = "emptyArrow"; //→箭头_节点标记
                                  }
                                  dataTemp.itemStyle = { borderColor: "#ff6666", color: "white" };
                              }
                              if (this.qcrule.qcruletype == "4") dataTemp.valueTrue = "rm定性质控";
                              if (dayLine["controlstatus" + qclevel] == "0") {
                                  //若失控，用红色实心表示
                                  // dataTemp.symbol = lines[i].symbol.substring(5).toLowerCase();
                                  dataTemp.symbolSize = 12;
                                  dataTemp.itemStyle = { color: "#ff6666" };
                              }
                              if (this.categorytype != 1) lines[i].data.push(dataTemp);
                              else {
                                  dataTemp.value = [dataTemp.qcdate.substring(5), dataTemp.value];
                                  lines[i].data.push(dataTemp);
                              }
                              //以下为线条 tooltip内容
                              let htmlStr = "";
                              htmlStr += "批&ensp;&ensp;号：" + dayLine["batchno" + qclevel];
                              htmlStr += "&ensp;&ensp;时间：";
                              htmlStr += dayLine["time" + qclevel].substring(11);
                              htmlStr += "&ensp;&ensp;签名：" + dayLine["checkuser" + qclevel];

                              if (this.qcrule.qcruletype == "4") {
                                  //定性质控显示
                                  if (this.qcOption.SHOWREAGENT == "1") {
                                      htmlStr += "<br/>试剂批号：" + (dayLine["reagentbatchno" + qclevel] != null ? dayLine["reagentbatchno" + qclevel] : "");
                                      htmlStr += "&ensp;&ensp;&ensp;&ensp;试剂厂商&ensp;&ensp;：" + (dayLine["reagentmnfcturname" + qclevel] != null ? dayLine["reagentmnfcturname" + qclevel] : "");
                                      htmlStr += "<br/>校准品批号：" + (dayLine["calibrateno" + qclevel] != null ? dayLine["calibrateno" + qclevel] : "");
                                      htmlStr += "&ensp;&ensp;校准品厂商：" + (dayLine["calibratemnfcturname" + qclevel] != null ? dayLine["calibratemnfcturname" + qclevel] : "");
                                  }
                                  htmlStr += "<br/>显示值：" + dayLine["display" + qclevel];
                                  // if (!XEUtils.isEmpty(dayLine["outcontrolresult" + qclevel])) {
                                  //     htmlStr += "<br/>处理结果：" + dayLine["outcontrolresult" + qclevel];
                                  // }
                              } else {
                                  //非定性质控显示
                                  htmlStr += "<br/>靶&ensp;&ensp;值：" + parseFloat(XEUtils.toFixedString(dayLine["tagvalue" + qclevel], 4));
                                  htmlStr += "&ensp;&ensp;SD：" + parseFloat(XEUtils.toFixedString(dayLine["itemvaluesd" + qclevel], 4));
                                  htmlStr += "&ensp;&ensp;CV：" + parseFloat(XEUtils.toFixedString(dayLine["itemvaluecv" + qclevel], 4));
                                  if (this.qcOption.SHOWREAGENT == "1") {
                                      htmlStr += "<br/>试剂批号：" + (dayLine["reagentbatchno" + qclevel] != null ? dayLine["reagentbatchno" + qclevel] : "");
                                      htmlStr += "&ensp;&ensp;&ensp;&ensp;试剂厂商&ensp;&ensp;：" + (dayLine["reagentmnfcturname" + qclevel] != null ? dayLine["reagentmnfcturname" + qclevel] : "");
                                      htmlStr += "<br/>校准品批号：" + (dayLine["calibrateno" + qclevel] != null ? dayLine["calibrateno" + qclevel] : "");
                                      htmlStr += "&ensp;&ensp;校准品厂商：" + (dayLine["calibratemnfcturname" + qclevel] != null ? dayLine["calibratemnfcturname" + qclevel] : "");
                                  }
                                  htmlStr += "<br/>测定值：" + dayLine["val" + qclevel] + "&ensp;&ensp;";
                                  if (dayLine["controlstatus" + qclevel] == "0") {
                                      // htmlStr += "<span style='background-color:#FF6666'>";
                                      htmlStr += "SD：" + dayLine["sd" + qclevel];
                                      // htmlStr += "</span>";
                                  } else {
                                      htmlStr += "SD：" + dayLine["sd" + qclevel];
                                  }
                                  htmlStr += "&ensp;&ensp;CV：" + dayLine["cv" + qclevel];
                              }
                              if (!XEUtils.isEmpty(dayLine["outcontrolreason" + qclevel])) {
                                  htmlStr += "<br/>失控原因：" + dayLine["outcontrolreason" + qclevel];
                              }
                              if (!XEUtils.isEmpty(dayLine["outcontroloperation" + qclevel])) {
                                  htmlStr += "<br/>失控处理：" + dayLine["outcontroloperation" + qclevel];
                              }
                              if (!XEUtils.isEmpty(dayLine["outcontrolresult" + qclevel])) {
                                  htmlStr += "<br/>处理结果：" + dayLine["outcontrolresult" + qclevel];
                              }
                              if (!XEUtils.isEmpty(dayLine["outtransokresult" + qclevel])) {
                                  htmlStr += "<br/>修正结果：" + dayLine["outtransokresult" + qclevel];
                                  var outtransokresultdate = "";
                              }
                              if (!XEUtils.isEmpty(dayLine["comments" + qclevel]) && this.qcOption.SHOWQCCOMMENTS == "1") {
                                  htmlStr += "<br/>备注" + dayLine["comments" + qclevel];
                              }
                              // if (dayLine["controlstatus" + qclevel] == "1") {
                              //     if (dayLine["cp_controlstatus" + qclevel] == "9") {
                              //         htmlStr += "<br/> 警&ensp;&ensp;告：" + dayLine["cp_outcontroltips" + qclevel];
                              //     } else {
                              //         if (i < lines.length - 2 && lines.length > 2) htmlStr += "<br/>";
                              //     }
                              // } else if (dayLine["controlstatus" + qclevel] == "0") {
                              //     htmlStr += "<br/>";
                              //     htmlStr += "失&ensp;&ensp;控： <span style='color:#FF9999'>";
                              //     htmlStr += dayLine["outcontroltips" + qclevel] + "</span>";
                              // } else {
                              //     htmlStr += "<br/>未判定";
                              // }
                              if (i < lines.length - 2 && lines.length > 2) htmlStr += "<br/>";
                              if (this.categorytype != 1) {
                                  lines[i + 1].data.push(htmlStr);
                                  lines[i + 1].data0.push(htmlStr);
                              } else {
                                  lines[i + 1].data.push([dataTemp.qcdate.substring(5), htmlStr]);
                                  lines[i + 1].data0.push([dataTemp.qcdate.substring(5), htmlStr]);
                              }
                              //在控 失控 标记
                              htmlStr = XEUtils.formatSelect(dayLine["controlstatus" + qclevel], this.controlstatusList);
                              if (this.categorytype != 1) lines[i].data0.push(htmlStr);
                              else lines[i].data0.push([dataTemp.qcdate.substring(5), htmlStr]);
                              break label;
                          }
                      }
                  }
                  if (this.categorytype != 1) {
                      lines[i].data.push("");
                      lines[i + 1].data.push("");
                      lines[i + 1].data0.push("");
                  } else {
                      lines[i].data.push(["", ""]);
                      lines[i + 1].data.push(["", ""]);
                      lines[i + 1].data0.push(["", ""]);
                  }
              }
          }
      },

      //获取Echar的图像
      getEcharImg() {
          var optionBase = this.charts.getOption();
          var option = XEUtils.clone(optionBase, true);
          option.color[0] = "#000000";
          option.color[2] = "#000000";
          option.color[4] = "#000000";
          option.color[6] = "#000000";
          option.color[8] = "#000000";
          option.color[10] = "#000000";
          //标题
          option.title[0].textStyle.color = "#000000";
          option.title[0].textStyle.fontSize = "18";
          //Y轴
          option.yAxis[0].axisLabel.color = "#000000";
          option.yAxis[0].axisLabel.textStyle.color = "#000000";
          option.yAxis[0].axisLabel.fontSize = "14";
          option.yAxis[0].axisLine.lineStyle.color = "#000000";
          option.yAxis[0].splitLine.lineStyle.color = "#000000";
          //X轴
          option.xAxis[0].axisLabel.color = "#000000";
          option.xAxis[0].axisLabel.textStyle.color = "#000000";
          option.xAxis[0].axisLabel.fontSize = "14";
          option.xAxis[0].axisLine.lineStyle.color = "#000000";
          option.xAxis[0].splitLine.lineStyle.color = "#000000";
          this.charts.setOption(option);
          var img = this.charts.getDataURL({
              type: "png",
              pixelRatio: 1.5, //放大两倍下载，之后压缩到同等大小展示。解决生成图片在移动端模糊问题
              backgroundColor: "#fff",
          });
          this.charts.setOption(optionBase);
          return img;
      },

      //画图
      draw() {
          var xAxisData = [];
          var series = [];
          var lineName = [];
          //this.queryQclevelCode = XEUtils.sortBy(this.queryQclevelCode);
          for (var n = 0; n < this.queryQclevelCode.length; n++) {
              var line = {
                  name: this.queryQclevel[n], //改为名称
                  namecode: this.queryQclevelCode[n],
                  type: "line",
                  symbolSize: 9,
                  data: [],
                  data0: [],
                  connectNulls: true,
              };
              if (this.qcrule.qcruletype == "4") line.lineStyle = { width: 3 }; // 定性质控加粗显示
              //遍历赋值质控图节点标记
              switch (n) {
                  case 0:
                      line.symbol = "circle"; //0圆_节点标记
                      break;
                  case 1:
                      line.symbol = "triangle"; //△三角形_节点标记
                      break;
                  case 2:
                      line.symbol = "roundRect"; //□圆角矩形_节点标记
                      break;
                  case 3:
                      line.symbol = "diamond"; //◇钻石_节点标记
                      break;
                  case 4:
                      line.symbol = "pin"; //○饼图_节点标记
                      break;
                  case 5:
                      line.symbol = "arrow"; //→箭头_节点标记
                      break;
                  default:
                      line.symbol = "circle";
              }
              series.push(line);
              lineName.push(line.name);
              var tip = {
                  name: "线说明" + this.queryQclevelCode[n],
                  type: "line",
                  connectNulls: true,
                  data: [],
                  data0: [],
              };
              series.push(tip);
          }

          let dataShowLength = this.tableDataShow.length;
          xAxisData.push("");
          for (var i = 0; i < dataShowLength; i++) {
              let date = this.tableDataShow[i].qcdate;
              if (this.categorytype != 1) {
                  let xname = date.substring(5) + (this.tableDataShow[i].seq > 1 ? "(" + this.tableDataShow[i].seq + ")" : "");
                  xAxisData.push(xname);
              } else {
                  let xname = date.substring(5);
                  if (this.tableDataShow[i].seq <= 1) {
                      xAxisData.push(xname);
                  }
              }
              if (i == 0) this.getDrawLine(null, series);
              this.getDrawLine(this.tableDataShow[i], series);
          }
          if (dataShowLength < 30) {
              for (var i = 0; i < 30 - dataShowLength; i++) {
                  xAxisData.push("");
              }
          }
          let interval = dataShowLength > this.echartsAxisInterval ? parseInt(dataShowLength / this.echartsAxisInterval + (dataShowLength % this.echartsAxisInterval == 0 ? 0 : 1)) : 0;
          interval--; //0 表示无间隔
          interval = 0;
          var yAxismax = 4; //Y轴坐标刻度
          var yAxismin = -4;
          var yAxisSplitAreaShow = true;
          //TODO 本地选项有需要再添加
          var splitLineColor = ["#ddd", this.splitLineColor.QCSPLITLINE3SDCOLOR, this.splitLineColor.QCSPLITLINE2SDCOLOR, this.splitLineColor.QCSPLITLINE1SDCOLOR, "#ddd", this.splitLineColor.QCSPLITLINE1SDCOLOR, this.splitLineColor.QCSPLITLINE2SDCOLOR, this.splitLineColor.QCSPLITLINE3SDCOLOR, "#ddd"]; //线条颜色
          var gridleft = 50; //左边空间大小
          this.echartSplitNumber = 8;
          if (this.qcrule.qcruletype == "4") {
              //定性质控显示界面的各项参数
              gridleft = 70;
              // yAxismax = this.echartSplitNumber;
              yAxismax = this.qcrule.itemjudge.length + 1;
              if (this.qcrule.itemjudge.length == 0) yAxismax = 3;
              yAxismin = 0;
              yAxisSplitAreaShow = false;
              splitLineColor = ["#ddd"]; //计算定性质控的线条的颜色
              //TODO 本地选项有需要再添加
              for (var i = this.qcrule.itemjudge.length - 1; i >= 0; i--) {
                  if (this.qcrule.itemjudge[i]["controlstatus"] == "0") splitLineColor.push(this.splitLineColor.QCITEMJUDGEOUTCONTROLCOLOR);
                  else splitLineColor.push(this.splitLineColor.QCITEMJUDGEINCONTROLCOLOR);
              }
              if (this.qcrule.itemjudge.length == 0) splitLineColor = ["#ddd", this.splitLineColor.QCITEMJUDGEINCONTROLCOLOR, this.splitLineColor.QCITEMJUDGEOUTCONTROLCOLOR, "#ddd"];
              this.echartSplitNumber = Math.max(this.qcrule.itemjudge.length, this.echartSplitNumber);
              if (this.echartSplitNumber > 8) gridleft = 105; //如果Y刻度大于8 则默认失控不换行了,增加Y刻度名称宽度
          }
          //加入 仅画点的线条
          for (var n = 0; n < this.drawpointData.length; n++) {
              let point = {
                  name: "水平 " + this.drawpointData[n].qclevel, //名称相同可使用 上方线条图例
                  namecode: this.drawpointData[n].qclevel,
                  data: this.drawpointData[n].data,
                  type: "scatter",
                  tooltip: { show: false },
              };
              for (var m = 0; m < series.length; m++) {
                  if (series[m].namecode == point.namecode) {
                      point.symbol = series[m].symbol;
                      point.symbolSize = series[m].symbolSize;
                      point.itemStyle = series[m].itemStyle;
                  }
              }
              if (this.drawpointData[n].controlstatus == "0") {
                  //若失控，用红色实心表示
                  point.symbol = point.symbol.substring(5).toLowerCase();
                  point.symbolSize = 12;
                  point.itemStyle = { color: "#ff6666" };
              }
              series.push(point);
          }

          if (this.qcOption.QCDATASHOWCHANGE == "1") {
              this.visualMap = [];
              this.visualMap.push({
                  show: false,
                  dimension: 0,
                  seriesIndex: 0,
                  pieces: [
                      {
                          gt: 1,
                          lt: 2,
                      },
                  ],
                  outOfRange: { opacity: 1 },
                  inRange: { opacity: 0 },
              });
          } else if (this.qcOption.QCDATASHOWCHANGE == "2") {
              this.visualMap = [];
              this.visualMap.push({
                  show: false,
                  dimension: 0,
                  seriesIndex: 0,
                  pieces: [
                      {
                          gt: 1,
                          lt: 2,
                      },
                  ],
                  outOfRange: { opacity: 1 },
                  inRange: { opacity: 0 },
              });
              var qclevel;
              var qclevelOld;
              var qcitemvalueid = 0;
              this.marklinedata = [];
              for (var n = 0; n < this.queryQclevelCode.length; n++) {
                  qclevel = this.queryQclevelCode[n];
                  qclevelOld = "";
                  for (var i = 0; i < this.tableDataShow.length; i++) {
                      let lineData = this.tableDataShow[i];
                      if (lineData["inuse" + qclevel] != "1") continue;
                      if (lineData["val" + qclevel] != null) {
                      } else continue;
                      if (qclevelOld != qclevel) {
                          qclevelOld = qclevel;
                      } else {
                          if (lineData["qcitemvalueid" + qclevel] != qcitemvalueid) {
                              this.marklinedata.push([{ coord: [lineData["qcdate" + qclevel].substring(5), -4.0] }, { coord: [lineData["qcdate" + qclevel].substring(5), 4.0] }]);
                          }
                      }
                      qcitemvalueid = lineData["qcitemvalueid" + qclevel];
                  }
              }

              var markline = {
                  name: "平行于y轴的趋势线",
                  type: "line",

                  markLine: {
                      name: "aa",
                      symbol: ["none", "none"],
                      silent: "true",
                      color: "red",
                      borderColor: "red",
                      lineStyle: {
                          type: "dashed",
                          color: "red",
                          borderColor: "red",
                          shadowColor: "red",
                          width: 2,
                      },
                      //  label: {
                      //     show: true,
                      //     position: "end",
                      //     formatter: "更换靶值",
                      //     color: "red",
                      //     borderColor:"red",
                      // },
                      data: this.marklinedata,
                  },
              };
              series.push(markline);
          } else {
              var qclevel;
              var qclevelOld;
              var qcitemvalueid = 0;
              var pieces = [];
              this.visualmap = [];
              this.marklinedata = [];
              for (var n = 0; n < this.queryQclevelCode.length; n++) {
                  qclevel = this.queryQclevelCode[n];
                  qclevelOld = "";
                  pieces = [];
                  for (var i = 0; i < this.tableDataShow.length; i++) {
                      let lineData = this.tableDataShow[i];
                      if (lineData["inuse" + qclevel] != "1") continue;
                      if (lineData["val" + qclevel] != null) {
                      } else continue;
                      if (qclevelOld != qclevel) {
                          qclevelOld = qclevel;
                      } else {
                          if (lineData["qcitemvalueid" + qclevel] != qcitemvalueid) {
                              pieces.push({
                                  gt: i,
                                  lt: i + 0.8, //避免点直接没了
                              });
                          }
                      }
                      qcitemvalueid = lineData["qcitemvalueid" + qclevel];
                  }
                  if (pieces.length > 0) {
                      this.visualmap.push({
                          show: false,
                          dimension: 0,
                          seriesIndex: n * 2,
                          pieces: pieces,
                          outOfRange: { opacity: 1 },
                          inRange: { opacity: 0 },
                      });
                  }
              }
          }
          //////////////////
          this.charts.setOption(
              {
                  animation: false, 
                  title: {
                      text: this.drawTitleText,
                      left: "left",
                      textStyle: { fontWeight: "700", fontSize: "13" },
                  },
                  // toolbox: {
                  //     textStyle: { fontWeight: "700", fontSize: "12" },
                  //     feature: {
                  //         dataZoom: {
                  //             yAxisIndex: "none"
                  //         },
                  //         restore: {}
                  //         //saveAsImage: {}
                  //     }
                  // },
                  // color: function (param) {
                  //     return param;
                  // },
                  tooltip: {
                      trigger: "axis", //axis item
                      // trigger: "item", //axis item
                      //axisPointer: { type: "cross" },
                      textStyle: { fontSize: 12 },
                      formatter: function (params, ticket, callback) {
                          var htmlStr = "";
                          for (var i = 0; i < params.length; i++) {
                              var param = params[i];
                              var xName = param.name; //x轴的名称
                              var seriesName = param.seriesName; //图例名称
                              var value = param.value; //param.value; //y轴值 valueTrue
                              var valueTrue = param.data.valueTrue; //
                              if (valueTrue) {
                                  value = XEUtils.toString(valueTrue);
                                  if (value == "rm定性质控") value = "";
                              }
                              var color = param.color; //图例颜色

                              if (i === 0) {
                                  htmlStr += xName + "<br/>"; //x轴的名称
                              }
                              htmlStr += "<div>";

                              // 具体显示的数据【字段名称：seriesName，值：value】
                              // 这里判断一下name，如果是我们需要特殊处理的，就处理
                              if (seriesName.substring(0, 3) === "线说明") {
                                  // 前面一条线 htmlStr += '<div style="border: 1px solid #FFEB3B"备注></div>';
                                  htmlStr += value + "<br/>";
                                  //后面一条线  htmlStr += '<div style="border: 1px solid #FFEB3B"></div>';
                              } else {
                                  // 正常显示的数据，走默认
                                  htmlStr += '<span style="margin-right:5px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' + color + ';"></span>';
                                  htmlStr += seriesName + "：" + value;
                                  //点的说明后， 显示失控说明
                                  if (param) {
                                      if (param.data.cp_controlstatus == "9") {
                                          htmlStr += "&ensp;&ensp;&ensp;&ensp;警告：<span style='color:#FFFF66'>" + param.data.cp_outcontroltips + "</span>";
                                      } else if (param.data.cp_controlstatus == "0") {
                                          htmlStr += "&ensp;&ensp;&ensp;&ensp;失控： <span style='color:#FF9999'>" + param.data.cp_outcontroltips + "</span>";
                                      }
                                  }
                              }
                              htmlStr += "</div>";
                          }
                          return htmlStr;
                      },
                  },
                  grid: {
                      //图形的 大小
                      show: true,
                      top: 45,
                      left: gridleft,
                      right: 5,
                      bottom: 37,
                  },
                  legend: {
                      //图例组件。 图例组件展现了不同系列的标记(symbol)，颜色和名字。可以通过点击图例控制哪些系列不显示。
                      left: "right",
                      data: lineName,
                  },
                  xAxis: {
                      type: "category",
                      data: xAxisData,
                      boundaryGap: false,
                      axisLabel: {
                          interval: interval, // 0= 显示所有标签,   1=表示隔一个标签  回调函数   (index:number, value: string) => boolean 第一个参数是类目的 index，第二个值是类目名称，如果跳过则返回 false
                          rotate: 30, //旋转的角度从 -90 度到 90 度。
                          fontSize: 9, //字体大小
                      },
                      axisTick: { alignWithLabel: true },

                      splitLine: {
                          show: true, //隐藏或显示
                          interval: 0,
                          //网格线
                          lineStyle: {
                              width: 1, // 粗细
                              // color: ['#ddd','#409EFF','#b1c9e2'],
                              color: "#ddd",
                              type: "solid", //设置网格线类型 dotted ：虚线   solid:实线  dashed
                          },
                          minorTick: {
                              show: true,
                          },
                          minorSplitLine: {
                              show: true,
                              // splitNumber: 10,
                              lineStyle: {
                                  color: "#ddd",
                              },
                          },
                      },
                  },
                  yAxis: {
                      type: "value",
                      max: yAxismax,
                      min: yAxismin,
                      splitArea: { show: yAxisSplitAreaShow },
                      splitNumber: this.echartSplitNumber,
                      minInterval: 1, //自动计算的坐标轴最小间隔大小  设置成1保证坐标轴分割刻度显示成整数。
                      axisLabel: {
                          interval: 0,
                          formatter: (value, index) => {
                              var a = Math.max(this.qcrule.iemjudge == undefined || this.qcrule.itemjudge.length == 0 ? 0 : this.qcrule.itemjudge.length, this.echartSplitNumber);
                              if (this.qcrule.qcruletype == "4") {
                                  for (var i = 0; i < this.qcrule.itemjudge.length; i++) {
                                      //这个要倒序排列
                                      if (this.qcrule.itemjudge.length - this.qcrule.itemjudge[i].seq / 10 == index - 1) {
                                          var na = this.qcrule.itemjudge[i].result_str + (this.qcrule.itemjudge.length > 8 ? "" : "\n");
                                          na += this.qcrule.judgetype == "1" ? "" : this.qcrule.itemjudge[i].controlstatus == "0" ? "(失控)" : "(在控)";
                                          return na;
                                      }
                                      //     //这个要倒序排列
                                      // if (this.qcrule.itemjudge.length - this.qcrule.itemjudge[i].seq / 10 == index - 1) {
                                      //     if(this.queryQclevelCode.length>1){
                                      //                 return this.qcrule.itemjudge[i].result_str ;
                                      //     }
                                      //     return this.qcrule.itemjudge[i].result_str + "\n" + (this.qcrule.itemjudge[i].controlstatus == "0" ? "(失控)" : "(在控)");
                                      // }
                                  }
                                  if (this.qcrule.itemjudge.length == 0) {
                                      if (index == 1) return "(在控)";
                                      if (index == 2) return "(失控)";
                                      if (index == 3) return "";
                                  }
                              } else {
                                  //非定性质控的Y轴
                                  if (this.slvshownum == "1" && this.allbatch == "0") {
                                      ////单水平单批号时Y轴显示数值
                                      let tagvalue = this.singlelevelshownum.tagvalue;

                                      let sd = this.singlelevelshownum.sd;
                                      return parseFloat((tagvalue + value * sd).toFixed(4));
                                  } else {
                                      if (value == 0) {
                                          return "X̅  ";
                                      }
                                      if (value != 4 && value != -4) return value + "SD";
                                  }
                              }
                          },
                      },
                      splitLine: {
                          show: true, //隐藏或显示
                          //网格线
                          lineStyle: {
                              width: 1, // 粗细
                              color: splitLineColor,
                              type: "solid", //设置网格线类型 dotted ：虚线   solid:实线  dashed
                          },
                          minorTick: {
                              show: true,
                          },
                          minorSplitLine: {
                              show: true,
                              lineStyle: {
                                  color: "#ddd",
                              },
                          },
                      },
                  },
                  visualMap: this.visualmap,
                  // visualMap:
                  //     {
                  //         show: false,
                  //         dimension: 0,
                  //         seriesIndex: 0,
                  //         pieces: [{
                  //             gt: 1,
                  //             lt: 2,
                  //         }],
                  //         outOfRange: { opacity: 1 },
                  //         inRange: { opacity: 0 },
                  //     },
                  series: series,
              },
              true
          );
          //this.getTableDataLines(); //生成线条信息
          this.getTableDataLinesunion(); //生成线条信息(合并模式)
      },

      //生成线条信息(合并模式)
      getTableDataLinesunion() {
          this.tableDataLinesunion = [];
          var lineText = {};
          var dataCnt = 0;
          var qclevel;
          var qclevelOld;
          var qcitemvalueid = 0;
          var numbers = [];
          var normalnums = [];
          var mnmuns = [];
          for (var n = 0; n < this.queryQclevelCode.length; n++) {
              qclevel = this.queryQclevelCode[n];
              qclevelOld = "";
              if (this.tableDataLinesunion.length > 0) {
                  this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineNum += dataCnt; //上一根线条数量
                  dataCnt = 0;
                  if (this.qcrule.qcruletype == "4") {
                      //定性质控无统计信息
                  } else {
                      //非定性质控才有统计信息
                      //上一根线线条统计信息
                      if (numbers.length > 0) {
                          let tempvalue;
                          tempvalue = this.$pub.stddevp(numbers);
                          this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineTagvalueunion = tempvalue.avgValue;
                          this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineSdunion = tempvalue.sdValue;
                          this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineCvunion = tempvalue.cvValue;
                      }
                      if (normalnums.length > 0) {
                          let normaltemp = this.$pub.stddevp(normalnums);
                          this.tableDataLinesunion[this.tableDataLinesunion.length - 1].normallineTagvalueunion = normaltemp.avgValue;
                          this.tableDataLinesunion[this.tableDataLinesunion.length - 1].normallineSdunion = normaltemp.sdValue;
                          this.tableDataLinesunion[this.tableDataLinesunion.length - 1].normallineCvunion = normaltemp.cvValue;
                      }
                      // if (this.monthNormalData.length > 0) {
                      //     this.monthNormalData.forEach((e) => {
                      //         if (e.qclevel == qclevel) {
                      //             mnmuns.push(e.calculatevalue);
                      //         }
                      //         if (mnmuns.length > 0) {
                      //             let mntemp = this.$pub.stddevp(mnmuns);
                      //             this.tableDataLinesunion[this.tableDataLinesunion.length - 1].mnlineTagvalueunion = mntemp.avgValue;
                      //             this.tableDataLinesunion[this.tableDataLinesunion.length - 1].mnlineSdunion = mntemp.sdValue;
                      //             this.tableDataLinesunion[this.tableDataLinesunion.length - 1].mnlineCvunion = mntemp.cvValue;
                      //         }
                      //     });
                      // }
                      numbers = [];
                      normalnums = [];
                      // mnmuns = [];
                  }
              }

              for (var i = 0; i < this.tableDataShow.length; i++) {
                  let lineData = this.tableDataShow[i];
                  if (lineData["inuse" + qclevel] != "1") continue;
                  if (lineData["val" + qclevel] != null) {
                  } else continue;
                  numbers.push(lineData["val" + qclevel]);
                  if (lineData["controlstatus" + qclevel] == "1") {
                      normalnums.push(lineData["val" + qclevel]);
                  }
                  //新线条
                  if (qclevelOld != qclevel) {
                      lineText = {};
                      lineText.lineLevel = qclevel;
                      lineText.lineName = lineData["qcname" + qclevel];
                      lineText.lineBatch = lineData["batchno" + qclevel];
                      var tptagvalue = XEUtils.isNumber(lineData["tagvalue" + qclevel]) ? lineData["tagvalue" + qclevel] : "";
                      var tpitemvaluesd = XEUtils.isFinite(lineData["itemvaluesd" + qclevel]) ? lineData["itemvaluesd" + qclevel] : "";
                      var tpitemvaluecv = XEUtils.isFinite(lineData["itemvaluecv" + qclevel]) ? lineData["itemvaluecv" + qclevel] : "";
                      lineText.lineTagvalue = tptagvalue;
                      lineText.lineSd = tpitemvaluesd;
                      lineText.lineCv = tpitemvaluecv;
                      lineText.lineExpriedt = XEUtils.toDateString(lineData["expriedt" + qclevel], "yyyy-MM-dd");
                      lineText.lineComm = "";
                      lineText.lineNum = 1;
                      lineText.linereagentmnfcturname = lineData["reagentmnfcturname" + qclevel] == null ? "" : lineData["reagentmnfcturname" + qclevel];
                      lineText.linereagentbatchno = lineData["reagentbatchno" + qclevel] == null ? "" : lineData["reagentbatchno" + qclevel];
                      lineText.linecalibratemnfcturname = lineData["calibratemnfcturname" + qclevel] == null ? "" : lineData["calibratemnfcturname" + qclevel];
                      lineText.linecalibrateno = lineData["calibrateno" + qclevel] == null ? "" : lineData["calibrateno" + qclevel];
                      this.tableDataLinesunion.push(lineText);
                      dataCnt = 0;
                      qclevelOld = qclevel;
                      if (this.qcrule.qcruletype == "4") {
                          lineText.lineComm = lineData["comm" + qclevel];
                      }
                  } else {
                      // //若有更换批号的情况，记录之 "<br> 更换: "+
                      if (lineData["qcitemvalueid" + qclevel] != qcitemvalueid) {
                          if (this.tableDataLinesunion.length > 0) {
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineNum += dataCnt;
                              dataCnt = 0;
                          }
                          var tptagvalue = XEUtils.isNumber(lineData["tagvalue" + qclevel]) ? lineData["tagvalue" + qclevel] : "";
                          var tpitemvaluesd = XEUtils.isFinite(lineData["itemvaluesd" + qclevel]) ? lineData["itemvaluesd" + qclevel] : "";
                          var tpitemvaluecv = XEUtils.isFinite(lineData["itemvaluecv" + qclevel]) ? lineData["itemvaluecv" + qclevel] : "";
                          if (this.qcOption.QCCHANGEITEMVALUESHOW == "1") {
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineBatch = lineData["batchno" + qclevel];
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineName = lineData["qcname" + qclevel];
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineTagvalue = tptagvalue;
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineSd = tpitemvaluesd;
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineCv = tpitemvaluecv;
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineExpriedt = XEUtils.toDateString(lineData["expriedt" + qclevel], "yyyy-MM-dd");
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineComm = XEUtils.toDateString(lineData["qcdate" + qclevel], "yyyy-MM-dd") + "更换批号/靶值 ";
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].linereagentmnfcturname = lineData["reagentmnfcturname" + qclevel] == null ? "" : lineData["reagentmnfcturname" + qclevel];
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].linereagentbatchno = lineData["reagentbatchno" + qclevel] == null ? "" : lineData["reagentbatchno" + qclevel];
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].linecalibratemnfcturname = lineData["calibratemnfcturname" + qclevel] == null ? "" : lineData["calibratemnfcturname" + qclevel];
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].linecalibrateno = lineData["calibrateno" + qclevel] == null ? "" : lineData["calibrateno" + qclevel];
                          } else {
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineBatch += "\n" + "更换: " + lineData["batchno" + qclevel];
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineName += "\n" + "更换: " + lineData["qcname" + qclevel];
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineTagvalue += "\n" + "更换: " + tptagvalue;
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineSd += "\n" + "更换: " + tpitemvaluesd;
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineCv += "\n" + "更换: " + tpitemvaluecv;
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineExpriedt += "\n" + "更换: " + XEUtils.toDateString(lineData["expriedt" + qclevel], "yyyy-MM-dd");
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineComm += "\n" + XEUtils.toDateString(lineData["qcdate" + qclevel], "yyyy-MM-dd") + "更换批号/靶值 ";
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].linereagentmnfcturname += "\n" + "更换: " + (lineData["reagentmnfcturname" + qclevel] == null ? "" : lineData["reagentmnfcturname" + qclevel]);
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].linereagentbatchno += "\n" + "更换: " + (lineData["reagentbatchno" + qclevel] == null ? "" : lineData["reagentbatchno" + qclevel]);
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].linecalibratemnfcturname += "\n" + "更换: " + (lineData["calibratemnfcturname" + qclevel] == null ? "" : lineData["calibratemnfcturname" + qclevel]);
                              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].linecalibrateno += "\n" + "更换: " + (lineData["calibrateno" + qclevel] == null ? "" : lineData["calibrateno" + qclevel]);
                          }
                      }
                      dataCnt++;
                  }
                  qcitemvalueid = lineData["qcitemvalueid" + qclevel];
              }
          }
          //循环完毕后，附加最后的数据
          if (this.tableDataLinesunion.length > 0) {
              this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineNum += dataCnt; //上一个线
              if (this.qcrule.qcruletype == "4") {
                  //定性质控无统计信息
              } else {
                  //非定性质控才有统计信息
                  if (numbers.length > 0) {
                      let tempvalue;
                      tempvalue = this.$pub.stddevp(numbers);
                      this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineTagvalueunion = tempvalue.avgValue;
                      this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineSdunion = tempvalue.sdValue;
                      this.tableDataLinesunion[this.tableDataLinesunion.length - 1].lineCvunion = tempvalue.cvValue;
                  }
                  if (normalnums.length > 0) {
                      let normaltemp = this.$pub.stddevp(normalnums);
                      this.tableDataLinesunion[this.tableDataLinesunion.length - 1].normallineTagvalueunion = normaltemp.avgValue;
                      this.tableDataLinesunion[this.tableDataLinesunion.length - 1].normallineSdunion = normaltemp.sdValue;
                      this.tableDataLinesunion[this.tableDataLinesunion.length - 1].normallineCvunion = normaltemp.cvValue;
                  }
                  if (this.monthNormalData.length > 0) {
                      this.queryQclevelCode.forEach((e) => {
                          mnmuns = [];
                          this.monthNormalData.forEach((a) => {
                              if (e == a.qclevel) {
                                  mnmuns.push(a.calculatevalue);
                              }
                          });
                          if (mnmuns.length > 0) {
                              let mntemp = this.$pub.stddevp(mnmuns);
                              this.tableDataLinesunion.forEach((b) => {
                                  if (b.lineLevel == e) {
                                      b.mnlineTagvalueunion = mntemp.avgValue;
                                      b.mnlineSdunion = mntemp.sdValue;
                                      b.mnlineCvunion = mntemp.cvValue;
                                  }
                              });
                          }
                      });
                  }
                  if (this.cumNormalData.length > 0) {
                      this.queryQclevelCode.forEach((e) => {
                          var tempdata = []; //同水平的所有数据
                          this.cumNormalData.forEach((a) => {
                              if (e == a.qclevel) {
                                  var p = {
                                      qclevel: a.qclevel,
                                      batchno: a.batchno,
                                      calculatevalue: a.calculatevalue,
                                  };
                                  tempdata.push(p);
                              }
                          });
                          if (tempdata.length > 0) {
                              var currbatch = "";
                              var lastbatch = "";
                              var numarr = [];
                              var valuestr = "";
                              var sdstr = "";
                              var cvstr = "";
                              for (var b = 0; b < tempdata.length; b++) {
                                  currbatch = tempdata[b].batchno;
                                  if (lastbatch == "") numarr.push(tempdata[b].calculatevalue); //首条
                                  if (lastbatch == currbatch) {
                                      numarr.push(tempdata[b].calculatevalue);
                                  } else {
                                      //发现不同批号,先把上一批号的计算
                                      if (lastbatch != "") {
                                          let cumtmp = this.$pub.stddevp(numarr);
                                          valuestr += "\n" + lastbatch + ":" + cumtmp.avgValue;
                                          sdstr += "\n" + lastbatch + ":" + cumtmp.sdValue;
                                          cvstr += "\n" + lastbatch + ":" + cumtmp.cvValue;
                                          //清空上批计算的数据
                                      }
                                      numarr = [];
                                      numarr.push(tempdata[b].calculatevalue);
                                  }
                                  if (b == tempdata.length - 1) {
                                      //最后一条计算
                                      let cumtmp = this.$pub.stddevp(numarr);
                                      valuestr += "\n" + currbatch + ":" + cumtmp.avgValue;
                                      sdstr += "\n" + currbatch + ":" + cumtmp.sdValue;
                                      cvstr += "\n" + currbatch + ":" + cumtmp.cvValue;
                                  }

                                  lastbatch = currbatch;
                              }
                              if (valuestr != "" && sdstr != "" && cvstr != "") {
                                  valuestr = valuestr.substring(1);
                                  sdstr = sdstr.substring(1);
                                  cvstr = cvstr.substring(1);
                                  this.tableDataLinesunion.forEach((c) => {
                                      if (c.lineLevel == e) {
                                          c.cumlineTagvalueunion = valuestr;
                                          c.cumlineSdunion = sdstr;
                                          c.cumlineCvunion = cvstr;
                                      }
                                  });
                              }
                          }
                      });
                  }
              }
          }
      },

      getTableDataLinesPromise() {
          return new Promise((s, f) => {
              this.$tool
                  .request({
                      url: "LIS/LIS5/LIS530",
                      method: "post",
                      data: {
                          action: "queryLinesData",
                          instrId: this.instrId,
                          queryDate1: this.queryDate[0],
                          queryDate2: this.queryDate[1],
                          allbatch: this.allbatch, //0单批号、1不分批号、2批号多选
                          showallbatch: this.showallbatch, //显示所有批号
                          showother: this.showother, //显示非累计点
                          qclevel: this.queryQclevelCode, //水平
                          batchno: this.batchno,
                          rptitemcode: this.rptitemcode,
                      },
                  })
                  .then((res) => {
                      if (res.errcode == "1") {
                          s(res);
                      } else {
                          f(res);
                      }
                  })
                  .catch((error) => {
                      f(error);
                  });
          });
      },
      //生成图形下方，线条的信息（表格形式展现）
      async getTableDataLines() {
          const res = await this.getTableDataLinesPromise();
          this.tableDataLines = [];
          var lineText = {};
          var dataCntLine = 0;
          var dataCnt = 0;
          var qclevel;
          var qclevelOld;
          var qcitemvalueid = 0;
          var numbers = [];
          this.printInusedata = [];
          this.printILastmonthdata = [];
          this.printInusedata = res.inusedata;
          this.printILastmonthdata = res.lastmonthdata;
          for (var n = 0; n < this.queryQclevelCode.length; n++) {
              qclevel = this.queryQclevelCode[n];
              qclevelOld = "";

              if (this.tableDataLines.length > 0) {
                  this.tableDataLines[this.tableDataLines.length - 1].lineNum = dataCnt; //上一根线条数量
                  dataCnt = 0;
                  if (this.qcrule.qcruletype == "4") {
                      //定性质控无统计信息
                  } else {
                      //非定性质控才有统计信息
                      //上一根线线条统计信息
                      if (numbers.length > 0) {
                          let tempvalue;
                          tempvalue = this.$pub.stddevp(numbers);
                          lineText = {};
                          lineText.lineLevel = "";
                          lineText.lineName = "";
                          lineText.lineBatch = "当前数据";
                          lineText.lineTagvalue = tempvalue.avgValue;
                          lineText.lineSd = tempvalue.sdValue;
                          lineText.lineCv = tempvalue.cvValue;
                          lineText.lineExpriedt = "";
                          lineText.lineComm = "";
                          lineText.lineNum = dataCntLine;
                          lineText.linereagentmnfcturname = "";
                          lineText.linereagentbatchno = "";
                          lineText.linereagentmnfcturname = "";
                          lineText.linecalibratemnfcturname = "";
                          lineText.linecalibrateno = "";
                          this.tableDataLines.push(lineText);
                          this.addLinesData(this.queryQclevelCode[n - 1]);
                      }
                      numbers = [];
                  }
              }

              for (var i = 0; i < this.tableDataShow.length; i++) {
                  let lineData = this.tableDataShow[i];
                  if (lineData["inuse" + qclevel] != "1") continue;
                  if (lineData["val" + qclevel] != null) {
                  } else continue;
                  numbers.push(lineData["val" + qclevel]);
                  //新线条
                  if (qclevelOld != qclevel) {
                      lineText = {};
                      lineText.lineLevel = qclevel;
                      lineText.lineName = lineData["qcname" + qclevel];
                      lineText.lineBatch = lineData["batchno" + qclevel];
                      if (this.qcrule.qcruletype == "4") {
                          lineText.lineTagvalue = "";
                          lineText.lineSd = "";
                          lineText.lineCv = "";
                      } else {
                          lineText.lineTagvalue = lineData["tagvalue" + qclevel];
                          lineText.lineSd = lineData["itemvaluesd" + qclevel];
                          lineText.lineCv = lineData["itemvaluecv" + qclevel];
                      }
                      lineText.lineExpriedt = XEUtils.toDateString(lineData["expriedt" + qclevel], "yyyy-MM-dd");
                      lineText.lineComm = "";
                      lineText.linereagentmnfcturname = lineData["reagentmnfcturname" + qclevel] == null ? "" : lineData["reagentmnfcturname" + qclevel];
                      lineText.linereagentbatchno = lineData["reagentbatchno" + qclevel] == null ? "" : lineData["reagentbatchno" + qclevel];
                      lineText.linecalibratemnfcturname = lineData["calibratemnfcturname" + qclevel] == null ? "" : lineData["calibratemnfcturname" + qclevel];
                      lineText.linecalibrateno = lineData["calibrateno" + qclevel] == null ? "" : lineData["calibrateno" + qclevel];
                      if (this.qcrule.qcruletype == "4") {
                          lineText.lineComm = lineData["comm" + qclevel];
                      }
                      lineText.lineNum = "";
                      this.tableDataLines.push(lineText);
                      dataCnt = 1;
                      dataCntLine = 1;
                      qclevelOld = qclevel;
                  } else {
                      // //若有更换批号的情况，记录之
                      if (lineData["qcitemvalueid" + qclevel] != qcitemvalueid) {
                          if (this.tableDataLines.length > 0) {
                              this.tableDataLines[this.tableDataLines.length - 1].lineNum = dataCnt;
                              dataCnt = 0;
                          }
                          let lineText = {};
                          lineText.lineLevel = qclevel;
                          lineText.lineName = lineData["qcname" + qclevel];
                          lineText.lineBatch = lineData["batchno" + qclevel];
                          if (this.qcrule.qcruletype == "4") {
                              lineText.lineTagvalue = "";
                              lineText.lineSd = "";
                              lineText.lineCv = "";
                          } else {
                              lineText.lineTagvalue = lineData["tagvalue" + qclevel];
                              lineText.lineSd = lineData["itemvaluesd" + qclevel];
                              lineText.lineCv = lineData["itemvaluecv" + qclevel];
                          }
                          lineText.lineExpriedt = XEUtils.toDateString(lineData["expriedt" + qclevel], "yyyy-MM-dd");
                          lineText.lineComm = XEUtils.toDateString(lineData["qcdate" + qclevel], "yyyy-MM-dd") + "更换批号/靶值";
                          lineText.lineNum = "";
                          lineText.linereagentmnfcturname = lineData["reagentmnfcturname" + qclevel] == null ? "" : lineData["reagentmnfcturname" + qclevel];

                          lineText.linereagentbatchno = lineData["reagentbatchno" + qclevel] == null ? "" : lineData["reagentbatchno" + qclevel];
                          lineText.linecalibratemnfcturname = lineData["calibratemnfcturname" + qclevel] == null ? "" : lineData["calibratemnfcturname" + qclevel];
                          lineText.linecalibrateno = lineData["calibrateno" + qclevel] == null ? "" : lineData["calibrateno" + qclevel];
                          this.tableDataLines.push(lineText);
                      }
                      dataCnt++;
                      dataCntLine++;
                  }
                  qcitemvalueid = lineData["qcitemvalueid" + qclevel];
              }
          }
          ////循环完毕后，附加最后的数据
          if (this.tableDataLines.length > 0) {
              if (numbers.length > 0) this.tableDataLines[this.tableDataLines.length - 1].lineNum = dataCnt; //上一个线
              if (this.qcrule.qcruletype == "4") {
                  //定性质控无统计信息
              } else {
                  //非定性质控才有统计信息
                  if (numbers.length > 0) {
                      let lineText = {};
                      let tempValue = this.$pub.stddevp(numbers);
                      lineText.lineLevel = "";
                      lineText.lineName = "";
                      lineText.lineBatch = "当前数据";
                      lineText.lineTagvalue = tempValue.avgValue;
                      lineText.lineSd = tempValue.sdValue;
                      lineText.lineCv = tempValue.cvValue;
                      lineText.lineExpriedt = "";
                      lineText.lineComm = "";
                      lineText.linereagentmnfcturname = "";
                      lineText.linereagentbatchno = "";
                      lineText.linecalibratemnfcturname = "";
                      lineText.linecalibrateno = "";
                      lineText.lineNum = dataCntLine;
                      this.tableDataLines.push(lineText);
                      this.addLinesData(qclevel);
                  }
              }
          }
      },
      //加载 累计数据 、 上月数据
      addLinesData(qclevel) {
          var lineText = {};
          lineText.lineLevel = "";
          lineText.lineName = "";
          lineText.lineExpriedt = "";
          lineText.lineComm = "";
          lineText.lineTagvalue = "";
          lineText.lineSd = "";
          lineText.lineCv = "";
          lineText.lineNum = "";
          lineText.linereagentmnfcturname = "";
          lineText.linereagentbatchno = "";
          lineText.linecalibratemnfcturname = "";
          lineText.linecalibrateno = "";
          lineText.lineBatch = "上月数据";

          for (var i = 0; i < this.printILastmonthdata.length; i++) {
              if (this.printILastmonthdata[i]["qclevel"] == qclevel) {
                  if (this.printILastmonthdata[i]["cp_x"]) lineText.lineTagvalue = parseFloat(this.printILastmonthdata[i]["cp_x"].toFixed(4));
                  if (this.printILastmonthdata[i]["cp_sd"]) lineText.lineSd = parseFloat(this.printILastmonthdata[i]["cp_sd"].toFixed(4));
                  if (this.printILastmonthdata[i]["cp_x"] && this.printILastmonthdata[i]["cp_sd"]) {
                      lineText.lineCv = lineText.lineTagvalue != 0 ? (lineText.lineSd * 100) / lineText.lineTagvalue : "";
                      lineText.lineCv = parseFloat(lineText.lineCv.toFixed(4));
                  }
                  if (this.printILastmonthdata[i]["cp_cnt"]) lineText.lineNum = this.printILastmonthdata[i]["cp_cnt"];
              }
          }
          this.tableDataLines.push(lineText);

          var lineText2 = {};
          lineText2.lineLevel = "";
          lineText2.lineName = "";
          lineText2.lineExpriedt = "";
          lineText2.linereagentmnfcturname = "";
          lineText2.linereagentbatchno = "";
          lineText2.linecalibratemnfcturname = "";
          lineText2.linecalibrateno = "";
          lineText2.lineComm = "";
          lineText2.lineTagvalue = "";
          lineText2.lineSd = "";
          lineText2.lineCv = "";
          lineText2.lineNum = "";
          lineText2.lineBatch = "累计数据";
          for (var i = 0; i < this.printInusedata.length; i++) {
              if (this.printInusedata[i]["qclevel"] == qclevel) {
                  if (this.printInusedata[i]["cp_x"]) lineText2.lineTagvalue = parseFloat(this.printInusedata[i]["cp_x"].toFixed(4));
                  if (this.printInusedata[i]["cp_sd"]) lineText2.lineSd = parseFloat(this.printInusedata[i]["cp_sd"].toFixed(4));
                  if (this.printInusedata[i]["cp_x"] && this.printInusedata[i]["cp_sd"]) {
                      lineText2.lineCv = lineText2.lineTagvalue != 0 ? (lineText2.lineSd * 100) / lineText2.lineTagvalue : "";
                      lineText2.lineCv = parseFloat(lineText2.lineCv.toFixed(4));
                  }
                  if (this.printInusedata[i]["cp_cnt"]) lineText2.lineNum = this.printInusedata[i]["cp_cnt"];
              }
          }
          this.tableDataLines.push(lineText2);
      },
      //以下为质控评价 标签 的操作
      // 新增质控评价
      addAppraise() {
          if (this.instrId == 0) return false;
          var row = {};
          row.qcdate = null;
          if (this.defaulttxt != "") row.appraisetext = this.defaulttxt;
          // row.qcdate = XEUtils.toStringDate(XEUtils.toDateString(new Date(), "yyyy-MM-dd"));
          this.insertRowAtLast(this.$refs.xTableAppraise, row);
      },
      // 删除质控评价
      deleteAppraise() {
          if (this.instrId == 0) return false;
          this.deleteRow(this.$refs.xTableAppraise, this.tableAppraiseData);
      },
      //提交质控评价
      saveAppraise(type) {
          var msg;
          if (this.instrId == 0) return false;
          //校验 数据
          if (type == 1) {
              //提交评价检测
              msg = this.valid(XEUtils.isNull(this.rptitemcode), "请选择项目");
              if (msg) return msg;

              var record = this.$refs.xTableAppraise.tableData;
              for (let i = 0, len = record.length; i < len; i++) {
                  msg = this.valid(record[i].qcdate, "第" + (i + 1) + "行 评价日期 必须填写！");
                  if (msg) return msg;
                  msg = this.valid(record[i].qcid, "第" + (i + 1) + "行 质控品 必须选择！");
                  if (msg) return msg;
                  msg = this.valid(record[i].appraisetext, "第" + (i + 1) + "行 评价内容 必须填写！");
                  if (msg) return msg;
              }
          } else if (type == 2) {
              var record = this.$refs.xTableAppraise.tableData;
              var haverechk = 0;
              record.forEach((e) => {
                  if (e.rechkuser == null && e.rechktext != null && e.rechktext != "") {
                      haverechk++;
                  }
              });
              if (haverechk == 0) {
                  msg = this.valid("", "无可审核评价：请检查审核意见是否填写。");
                  if (msg) return msg;
              }
          } else if (type == 3) {
              var record = this.$refs.xTableAppraise.tableData;
              var haverechk = 0;
              record.forEach((e) => {
                  if (e.rechkuser != null && e.rechktext == "") {
                      haverechk++;
                  }
              });
              if (haverechk == 0) {
                  msg = this.valid("", "解除审核失败：解除审核前需清除审核意见。");
                  if (msg) return msg;
              }
          }
          let xTable1data = this.$refs.xTableAppraise.getRecordset();
          this.getDataByAjax(
              {
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "saveAppraise",
                      rptitemcode: this.rptitemcode,
                      urec: xTable1data,
                      type: type,
                  },
              },
              "操作成功！",
              "保存失败！",
              (data) => {
                  //okFunction
                  //this.initialList();
                  this.getData();
              },
              (data) => {
                  //errFunction
              }
          );
      },
      AppraiseRowClassName({ row }) {
          if (row.appraisetime != null && row.rechkdt != null) {
              return "rechk";
          }
      },
      //质控签名页面，初始化
      qcsignInit() {
          this.tableDataQcsign = []; //质控签名
          this.xTableQcsignCheckAll = { checkAll: false }; //质控签名窗口第一列，选择
          this.qcsignRptitemcode = this.rptitemcode;
          this.qcsignRptitemcodes = [];
          this.qcsignBatchno = "";
          this.qcsignBatchnos = [];
          this.qcsignChecked = "0"; //质控签名窗口 all=全部 1=已审核 0=未签名
          for (var i = 0; i < this.tableDataRptitem.length; i++) {
              let rptitem = {};
              rptitem.key = this.tableDataRptitem[i].rpt_itemcode;
              rptitem.value = this.tableDataRptitem[i].rpt_itemcode;
              rptitem.label = this.tableDataRptitem[i].rpt_itemname;
              this.qcsignRptitemcodes.push(rptitem);
          }

          this.getDataByAjax(
              {
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "getQcsignBatchList",
                      instrId: this.instrId,
                      qcsignDate1: this.qcsignDate[0],
                      qcsignDate2: this.qcsignDate[1],
                  },
              },
              "",
              "",
              (data) => {
                  for (var i = 0; i < data.length; i++) {
                      let batchno = {};
                      batchno.key = data[i].batchno;
                      batchno.value = data[i].batchno;
                      batchno.label = data[i].cp_name;
                      this.qcsignBatchnos.push(batchno);
                  }
              },
              (data) => {
                  //errFunction
              }
          );
      },
      //获取质控签名数据
      getQcsignData() {
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "getQcsignData",
                      instrId: this.instrId,
                      queryDate1: this.qcsignDate[0],
                      queryDate2: this.qcsignDate[1],
                      allbatch: this.qcsignBatchno == "" ? "1" : "", //0单批号、1不分批号、2批号多选
                      qclevel: this.queryQclevelCode, //["1", "2", "3", "4", "5", "6"], //水平
                      batchno: this.qcsignBatchno,
                      rptitemcode: this.qcsignRptitemcode,
                      checkflag: this.qcsignChecked,
                  },
              })
              .then((response) => {
                  if (response.errcode == "1") {
                      let tempTable = [];
                      for (var i = 0; i < response.Data.length; i++) {
                          if (response.Data[i].controlstatus == null) continue;
                          tempTable.push(response.Data[i]);
                      }
                      this.tableDataQcsign = tempTable;
                  }
              });
      },
      //质控签名弹窗 审核
      qcsignCheck() {
          this.qcsignCheckComm("1");
      },
      qcsignUnCheck() {
          this.qcsignCheckComm("2");
      },
      //质控签名弹窗审核公用函数 type=1 审核 2取消审核
      qcsignCheckComm(type) {
          if (this.qcsignuser == "") return false;
          var msg = "";
          msg = type == "1" ? "签名" : "取消签名";
          var selectRows = this.$refs.xTableQcsign.getSelectRecords();
          if (selectRows) {
              var qcdata = [];
              for (let index in selectRows) {
                  let item = {
                      qcdataid: selectRows[index].qcdataid,
                  };
                  qcdata[index] = item;
              }
          } else {
              return;
          }
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "qcsignCheck",
                      qcdata: qcdata,
                      qcsignuser: this.qcsignuser,
                      type: type,
                  },
              })
              .then((response) => {
                  if (response.errcode == "1") {
                      this.$message({
                          message: msg + "成功！",
                          type: "success",
                      });
                      this.qcsignRefresh_click();
                  } else {
                      this.$message({
                          dangerouslyUseHTMLString: true,
                          message: msg + "失败！<br/><br/>详细信息：" + response.errmsg,
                          type: "warning",
                      });
                  }
              });
      },

      async qcprint_qcdata() {
          const res = await this.getTableDataLines();
          //this.qcOption.QCDATASHOWUSER; //质控图数据显示操作员
          if (this.tableDataShow.length < 1) return;
          this.printQcdataDate = [];
          let printdata = [];
          let row = {};
          let dataLength = this.printQcdataLen * this.printQcdataRow; 
          row.rowname = "日期";
          for (let i in this.tableDataShow) {
              if (i >= dataLength) break;
              // if (this.tableDataShow[i].seq > 1) {
              //     row[this.tableDataShow[i].qcdate + "-" + i] = this.tableDataShow[i].qcdate.substring(5) + "(" + this.tableDataShow[i].seq + ")";
              // } else
              row[this.tableDataShow[i].qcdate + "-" + i] = this.tableDataShow[i].qcdate.substring(5);
              this.printQcdataDate[i] = this.tableDataShow[i].qcdate + "-" + i;
          }
          printdata.push(row);
          for (var n = 0; n < this.queryQclevelCode.length; n++) {
              let row = {};
              let checkuser = {};
              //需要在之前代码中，保证 queryQclevel 和 queryQclevelCode有对应关系
              row.rowname = this.queryQclevel[n];
              for (let i in this.tableDataShow) {
                  if (this.tableDataShow[i]["inuse" + this.queryQclevelCode[n]] != "1") continue;
                  if (i >= dataLength) break;
                  row[this.tableDataShow[i].qcdate + "-" + i] = this.$pub.checkNullOrUndefined(this.tableDataShow[i]["val" + this.queryQclevelCode[n]]);
              }
              printdata.push(row);
              if (this.printcheck == "1") {
                  checkuser.rowname = "签名人";
                  for (let i in this.tableDataShow) {
                      if (this.tableDataShow[i]["inuse" + this.queryQclevelCode[n]] != "1") continue;
                      if (i >= dataLength) break;
                      checkuser[this.tableDataShow[i].qcdate + "-" + i] = this.$pub.checkNullOrUndefined(this.tableDataShow[i]["checkuser" + this.queryQclevelCode[n]]);
                  }
                  printdata.push(checkuser);
              }
          }
          this.tableDataPrintQcdata = this.printdataSplit(printdata, this.printQcdataLen); //转换10列格式   this.printQcdataLen设定目前15
          var printAppraise = [];
          if (this.tableAppraiseData.length > 0) {
              printAppraise = this.tableAppraiseData;
              var username = "";
              printAppraise.forEach((e) => {
                  if (e.rechkusername != "" && e.rechkusername != null) {
                      username = e.rechkusername;
                  }
              });
          }
          if (username != "" && this.printQcFooter.length > 2 && this.printQcFooter[2] == " ") {
              if (username == undefined) username = "";
              this.printQcFooter[2] = "主管签名：" + username;
          }
      },
      //转换数据格式
      printdataSplit(printdata, n) {
          if (!(n > 0) && n >= this.printQcdataDate.length) return printdata;
          var dataTemp = [];
          let rows = [];
          let printdataLength = printdata.length;
          for (var i = 0; i < this.printQcdataDate.length; i++) {
              let g = parseInt(i / n);
              let mod = i % n;
              for (var m = 0; m < printdataLength; m++) {
                  if (mod == 0) {
                      rows[m] = {};
                      rows[m].rowname = printdata[m].rowname;
                  }
                  let data = printdata[m][this.printQcdataDate[i]];
                  rows[m][this.printQcdataDate[mod]] = data ? data : data == 0 ? 0 : "";
              }
              if (mod == n - 1 || i + 1 == this.printQcdataDate.length) {
                  for (var x = 0; x < rows.length; x++) {
                      dataTemp.push(rows[x]);
                  }
                  rows = [];
              }
          }
          return dataTemp;
      },

      saveCustomColumnData() {}, //禁止xtable缓存上次的设置
      loadCustomColumnData() {}, //禁止xtable自动加载上次的设置

      //显示值更改
      displaychange(val, row) {
          if (val != "" && val != null) {
              if (!isNaN(val)) {
                  row.calculatevalue = parseFloat(val).toFixed(4);
              }
          }
      },
      rptitemAllSelectChange(rptitemcode, qclevel) {
          this.tableDataAll = [];
          // let msg = this.valid(rptitemcode, "请选择项目！"); //项目校验
          // if (msg) return false;
          var batchno = this.getQueryBatch();
          if (batchno == "-1") return;
          this.bAllSLoading = true;
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "queryRptitemAll",
                      instrId: this.instrId,
                      qcdate1: this.queryDateAll[0],
                      qcdate2: this.queryDateAll[1],
                      rptitemcode: rptitemcode,
                      qclevel: qclevel,
                      batchno: batchno,
                  },
              })
              .then((res) => {
                  this.qclevelAllEnable = [];
                  this.bAllSLoading = false;
                  if (res.errcode == "1") {
                      this.tableDataAll = res.Data;
                      var alldata = res.AllData;
                      for (var i = 0; i < alldata.length; i++) {
                          let val = {
                              value: alldata[i].val,
                              label: alldata[i].na,
                          };
                          this.qclevelAllEnable.push(val);
                      }
                  } else {
                      this.tableDataAll = [];
                      this.qclevelAllEnable = "";
                  }
              })
              .catch(() => {
                  this.bAllSLoading = false;
              });
      },
      qcdataAllAdd() {
          // 添加对录入权限判断与控制
          if (this.powRet == 0) {
              this.$message({
                  type: "warning",
                  showClose: true,
                  message: "权限不足:缺少质控录入权限。",
              });
              return false;
          }
          if (this.allbatch != "0") {
              this.$message({
                  type: "warning",
                  message: "请在【单批号】模式下进行新增。",
              });
              return;
          }
          var batchno = this.getQueryBatch();
          if (batchno == "-1") return;
          let msg = this.valid(this.qclevelAllSelect, "请选择【新增】按钮左侧下拉框的【水平】 "); // 校验
          if (msg) return false;
          this.$tool
              .request({
                  url: "LIS/LIS5/LIS530",
                  method: "post",
                  data: {
                      action: "getQcid",
                      instrId: this.instrId,
                      batchno: batchno,
                      qclevel: this.qclevelAllSelect,
                  },
              })
              .then((res) => {
                  if (res.errcode == 1) {
                      var qcid = res.qcid;
                      if (this.rptitemAllSelect && this.instrId > 0 && qcid > 0) {
                          var AddIndex = 0;
                          var nowdate = XEUtils.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss");
                          var qcdate = XEUtils.toDateString(new Date(), "yyyy-MM-dd");
                          var indexdata = this.$refs.xTableAll.getTableData().fullData.filter((item) => XEUtils.toDateString(item.qcdate, "yyyy-MM-dd") == qcdate);
                          if (indexdata.length > 0) {
                              XEUtils.sortBy(indexdata, ["qcvaluesign"]);
                              AddIndex = indexdata[indexdata.length - 1].qcvaluesign - 0;
                          } else {
                              AddIndex = 0;
                          }
                          var newrow = {};
                          newrow.qcdate = qcdate;
                          newrow.qcvaluesign = ++AddIndex;
                          newrow.instrid = this.instrId;
                          newrow.qclevel = this.qclevelAllSelect;
                          newrow.rpt_itemcode = this.rptitemAllSelect;
                          newrow.batchno = batchno;
                          newrow.qcid = qcid;
                          newrow.resultdt = nowdate;
                          newrow.inuseflag = "1";
                          newrow.drawflag = "1";
                          newrow.checkflag = "0";
                          newrow.lastmodifydt = nowdate;
                          this.insertRowAtLast(this.$refs.xTableAll, newrow);
                      }
                  } else {
                      this.$message.error(res.errmsg);
                  }
              })
              .catch((e) => {});
      },
      qcdataAllDelete() {
          // 添加对录入权限判断与控制
          if (this.powRet == 0) {
              this.$message({
                  type: "warning",
                  showClose: true,
                  message: "权限不足:缺少质控录入权限。",
              });
              return false;
          }
          var tables = [];
          var selectRows = this.$refs.xTableAll.getSelectRecords();
          if (selectRows) {
              for (let index in selectRows) {
                  tables.push(selectRows[index].qcdataid);
              }
          } else {
              return;
          }
          if (tables.length == 0) return;
          this.$confirm("你确定删除这些质控记录?", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
          }).then(() => {
              this.$tool
                  .request({
                      url: "LIS/LIS5/LIS530",
                      method: "post",
                      data: {
                          action: "deldata",
                          tables: tables,
                          delinfo: selectRows,
                      },
                  })
                  .then((response) => {
                      if (response.errcode == "1") {
                          this.$message({
                              type: "success",
                              showClose: true,
                              message: "删除成功!",
                          });
                          this.rptitemAllSelectChange(this.rptitemAllSelect, this.qclevelAllSelect);
                      } else {
                          this.$message({
                              dangerouslyUseHTMLString: true,
                              showClose: true,
                              message: "删除失败！<br/><br/>详细信息：" + response.errmsg,
                              type: "warning",
                          });
                      }
                  })
                  .catch((e) => {
                      console.log("error", e);
                  });
          });
      },
      qcdataAllSave() {
          // 添加对录入权限判断与控制
          var forbidflag = "0";
          if (this.powRet == 0) {
              this.$message({
                  type: "warning",
                  showClose: true,
                  message: "权限不足:缺少质控录入权限。",
              });
              return false;
          }
          var records = this.$refs.xTableAll.getRecordset();
          var logrecords = {
              insertRecords: [],
              removeRecords: [],
              updateRecords: [],
          };
          if (records.updateRecords.length > 0) {
              records.updateRecords.forEach((e) => {
                  if (e.cdata.calculatevalue != e.odata.calculatevalue || e.cdata.displayvalue != e.odata.displayvalue) {
                      if (this.option2102 && (e.cdata.modifyreason == "" || XEUtils.isUndefined(e.cdata.modifyreason))) {
                          forbidflag = "1";
                          this.$alert("修改结果时，请您填写修改原因。", "保存失败");
                          return false;
                      } else {
                          //发生改动
                          var p = {
                              qcid: e.cdata.qcid,
                              qcdate: e.cdata.qcdate,
                              rpt_itemcode: e.cdata.rpt_itemcode,
                              qcvaluesign: e.cdata.qcvaluesign,
                              modifyreason: e.cdata.modifyreason,
                              olddisplayvalue: e.odata.displayvalue,
                              oldcalculatevalue: e.odata.calculatevalue,
                              newdisplayvalue: e.cdata.displayvalue,
                              newdisplayvalue: e.cdata.displayvalue,
                          };
                          logrecords.insertRecords.push(p);
                      }
                  }
              });
          }
          if (forbidflag == "0") {
              this.$tool
                  .request({
                      url: "LIS/LIS5/LIS530",
                      method: "post",
                      data: {
                          action: "savedata",
                          saveinfo: this.$refs.xTableAll.getRecordset(),
                          loginfo: logrecords,
                          QCDYNAMICTAGMODCLEAR: this.qcOption.QCDYNAMICTAGMODCLEAR,
                      },
                  })
                  .then((res) => {
                      if (res.errcode == 1) {
                          this.$message({
                              type: "success",
                              showClose: true,
                              message: "保存成功!",
                          });
                          this.rptitemAllSelectChange(this.rptitemAllSelect, this.qclevelAllSelect);
                      } else {
                          this.$message.error(res.errmsg);
                      }
                  })
                  .catch((e) => {
                      this.loading = false;
                  });
          }
      },
      allDataFormatFun({ cellValue, column }) {
          if (["rpt_itemcode"].includes(column.property)) {
              try {
                  let rpt_item = this.rptitemAll.find((m) => m.value == cellValue);
                  if (rpt_item != undefined && rpt_item != null) {
                      return rpt_item.label;
                  } else {
                      return cellValue;
                  }
              } catch {}
          }
      },
      ///////////////////////////////////工具函数 /////////////////////////////////////////
      getDataByAjax(
          request,
          okMsg,
          errMsg,
          okFunction, // 取得数据后的回调函数
          errFunction // 获取数据失败后回调函数
      ) {
          this.$tool.request(request).then((response) => {
              if (response.errcode == "1") {
                  if (XEUtils.isString(okMsg)) {
                      if (XEUtils.getSize(XEUtils.trim(okMsg)) > 0) {
                          this.$message({
                              message: okMsg,
                              type: "success",
                              showClose: true,
                          });
                      }
                  }
                  if (typeof okFunction == "function") okFunction(response.Data);
              } else {
                  this.$message({
                      dangerouslyUseHTMLString: true,
                      showClose: true,
                      message: errMsg + "<br><br>11详细信息：" + response.errmsg,
                      type: "warning",
                  });
                  if (typeof errFunction == "function") errFunction(response.Data);
              }
          });
      },

      insertRowAtLast(xtable, row) {
          xtable.insertAt(row, -1); //在最后添加一行
          var curow = xtable.getTableData().fullData[xtable.getTableData().fullData.length - 1]; //获取 新加的行对象 row 数据集合
          xtable.setCurrentRow(curow); //高亮显示行
          this.$nextTick(() => {
              xtable.scrollToRow(curow); //待数据加载完成后，延迟 滚动 到行
          });
      },

      //自动加载表格的第一行，并执行回调函数
      loadFirstRow(xTable, func) {
          if (xTable != undefined) {
              this.$nextTick(() => {
                  // 加载第一行
                  var selectrow = xTable.getData(0);
                  if (selectrow) {
                      xTable.setCurrentRow(selectrow); //高亮行
                      xTable.scrollToRow(selectrow); //滚动到行
                      if (typeof func == "function") func(selectrow);
                  } else {
                      xTable.setCurrentRow(null); //这个不会自动清空
                  }
              });
          }
      },

      //自制必填校验函数，以后待扩展
      valid(obj, message) {
          if (XEUtils.isUndefined(obj)) {
              return this.$message({
                  message: message,
                  type: "warning",
                  showClose: true,
              });
          }
          if (XEUtils.isNull(obj)) {
              return this.$message({
                  message: message,
                  showClose: true,
                  type: "warning",
              });
          }
          if (XEUtils.isString(obj)) {
              if (!XEUtils.getSize(obj) > 0) {
                  return this.$message({
                      message: message,
                      showClose: true,
                      type: "warning",
                  });
              }
          }
          if (XEUtils.isDate(obj)) {
              if (obj < XEUtils.toStringDate("2000-01-01")) {
                  return this.$message({
                      message: message,
                      type: "warning",
                      showClose: true,
                  });
              }
          }
      },
      xTableRCellClassName({ row, column }) {
          return "basecss";
      },
      /*
      echarts图转base64
      ele 图表DOM 容器ID   对应例子的ID("#fixed")
      */
      createBase64(ele) {
          let docEle = ele + " canvas";
          let canvasFixed = document.querySelector(docEle), //获取图表元素
              canvasWidth = canvasFixed.width, //获取图表元素宽度
              canvasHeigth = canvasFixed.heigth, //获取图表元素高度
              canvas2D = canvasFixed.getContext("2d");
          canvas2D.drawImage(canvasFixed, canvasWidth, canvasHeigth);
          return canvasFixed.toDataURL();
      },
      //删除表格行工具//TODO 连续 点删除按钮会有失去焦点的问题待解决
      deleteRow(xTable, tableData) {
          xTable.updateListenter();
          var delrow = xTable.getCurrentRow();
          if (delrow) {
              var alld = xTable.tableFullData;
              var rowindex = alld.indexOf(delrow);
              xTable.remove(delrow);
              // await this.btnSave().then(() => {
              // this.lXTableData.splice(rowindex, 1)
              let havedata = xTable.tableData;
              if (havedata.length > 0) {
                  if (rowindex >= havedata.length) rowindex = havedata.length - 1;
                  let selectrow = havedata[rowindex];
                  xTable.setCurrentRow(selectrow);
              } else {
                  xTable.setCurrentRow(null);
                  this.tableData = {};
              }
              // })
          }

          // var DelIndex = xTable.getRowIndex(delrow);
          // xTable.remove(delrow);
          // if (DelIndex > -1 && xTable.tableData.length > 0) {
          //     if (xTable.getTableData().fullData.length > DelIndex) DelIndex = DelIndex;
          //     else this.DelIndex = DelIndex - 1;
          //     var selectrow = xTable.getTableData().fullData[DelIndex];
          //     this.$nextTick(() => {
          //         xTable.setCurrentRow(selectrow);
          //     });
          // } else {
          //     var nowdata = xTable.getTableData().fullData.filter((item) => {
          //         return item._XID < delrow._XID;
          //     });
          //     if (nowdata.length > 0) {
          //         var selectrow = nowdata[nowdata.length - 1];
          //         this.$nextTick(() => {
          //             xTable.setCurrentRow(selectrow);
          //         });
          //     }
          // }
      },
      ////以下为分割条控件，指定函数////////////////////////////////////////////////////////////
      yleftmousedown(ev) {
          let that = this;
          let el = ev.target;
          var disX = ev.clientX - el.offsetLeft;
          document.onmousemove = function (ev) {
              var l = ev.clientX - disX;
              if (l < 20) l = 20;
              that.leftwidth = l;
          };
          document.onmouseup = function () {
              document.onmousemove = null;
              document.onmouseup = null;
          };
      },
      yrightmousedown(ev) {
          let that = this;
          let el = ev.target;
          var disX = ev.clientX - el.offsetLeft;
          document.onmousemove = function (ev) {
              var l = ev.clientX - disX;
              let rw = el.parentElement.clientWidth - l;
              if (rw < 20) rw = 20;
              that.rightwidth = rw;
          };
          document.onmouseup = function () {
              document.onmousemove = null;
              document.onmouseup = null;
          };
      },
      xtopmousedown(ev) {
          let that = this;
          let el = ev.target;
          var disY = ev.clientY - el.offsetTop;
          document.onmousemove = function (ev) {
              var l = ev.clientY - disY;
              if (l < 20) l = 20;
              that.topheight = l;
          };
          document.onmouseup = function () {
              document.onmousemove = null;
              document.onmouseup = null;
          };
      },
      xbottommousedown(ev) {
          let that = this;
          let el = ev.target;
          var disY = ev.clientY - el.offsetTop;
          document.onmousemove = function (ev) {
              var l = ev.clientY - disY;
              let bh = el.parentElement.clientHeight - l;
              if (bh < 20) bh = 20;
              that.bottomheight = bh;
          };
          document.onmouseup = function () {
              document.onmousemove = null;
              document.onmouseup = null;
          };
      },
  },
  beforeRouteEnter(to, from, next) {
      next((vm) => {
          let that = vm;
          let altArr = [];
          document.onkeydown = function (e) {
              let key = window.event.keyCode;
              //*组合按键
              if (altArr.length > 0) {
              } else {
                  if (key == 119) {
                      //F8
                      that.getData();
                  } else if (key == 120) {
                      //F9
                      that.qcsign_click();
                  } else if (key == 121) {
                      //F10
                      that.qcprint_click();
                  } else if (key == 122) {
                      //F11
                      that.qcprint_preview_click();
                  } else if (key == 18) {
                      //按下了alt
                      altArr.push(key);
                  } else if (key == 38) {
                      //按下了方向键
                      that.InputMove();
                  } else if (key == 40) {
                      //按下了方向键
                      that.InputMove();
                  }
              }
          };
          document.onkeyup = function (e) {
              let key = window.event.keyCode;
              if (key == 18) {
                  altArr = [];
              }
          };
      });
  },
};
</script>

<style scoped>
.pagetop {
  width: 100%;
  height: 90px;
  display: -webkit-box;
  -webkit-box-pack: left;
  -webkit-box-align: center;
  border: 1px solid #ccc;
  position: absolute;
}

.pagecenter {
  position: absolute;
  width: 100%;
  left: 0;
  top: 75px;
  border: 0px solid #ccc;
  overflow: auto;
}

.pagebottom {
  width: 100%;
  bottom: 0px;
  display: -webkit-box;
  -webkit-box-pack: left;
  -webkit-box-align: center;
  border: 1px solid #ccc;
  position: absolute;
}

.middle-left {
  position: absolute;
  height: 100%;
  left: 0px;
  overflow: auto;
  background-color: aqua;
}

.middle-right {
  position: absolute;
  height: 100%;
  right: 0px;
  bottom: 0px;
  overflow: visible;
}
.middle-center {
  position: absolute;
  height: 100%;
  overflow: auto;
}
.ysplit {
  height: 100%;
  width: 5px;
  position: absolute;
  z-index: 99;
  cursor: col-resize;
}
.xsplit {
  width: 100%;
  height: 5px;
  position: absolute;
  z-index: 99;
  cursor: row-resize;
}
table tr td:nth-child(odd) {
  text-align: right;
  white-space: nowrap;
  font-size: 12px;
}
table tr td:nth-child(even) {
  text-align: left;
}
/*
table tr td:nth-child(1) {
width: 80px;
}
*/
.showDataTable {
  font-size: 12px;
}

.showDataTable tr td {
  padding: 5px 0px 5px 0px;
}
.Printtable tr td {
  border: 1px solid #eee;
  line-height: 15px;
}
.Printtable {
  text-align: center;
  font-size: 12px;
  border: 1px solid #eee;
  border-spacing: 0px;
}
.gray {
  -webkit-filter: grayscale(1);
  -moz-filter: grayscale(1);
  -ms-filter: grayscale(1);
  -o-filter: grayscale(1);
  filter: grayscale(1);
  filter: gray;
}
.tooltipitem {
  margin: 4px;
}
::v-deep .PrintClass .vxe-cell {
  padding: 0 0;
}
/*使用 /deep/ vscode会显示红色错误 */
::v-deep .lis530outcontrol {
  background-color: #ffcccc !important;
}
::v-deep .lis530outcontrolNull {
  background-color: #cccccc !important;
}
::v-deep .lis530check {
  background-color: #ccffcc !important;
}
::v-deep .el-input.is-disabled .el-input__inner {
  color: black;
}
::v-deep.showPrintQcdataClass .vxe-table .vxe-table--body-wrapper,
.vxe-table .vxe-table--footer-wrapper,
.vxe-table .vxe-table--header-wrapper {
  overflow: hidden;
}
::v-deep .vxe-table--header .vxe-header--column {
  border-right: 1px solid #cccccc;
  border-bottom: 1px solid #ccc;
}
::v-deep .rechk {
  background-color: #c0ffc0;
}
::v-deep .print {
  white-space: pre-line;
}
.basecss {
  width: 100%;
  outline: none;
  border-color: rgba(0, 0, 0, 0);
}
.input {
  border-color: rgba(0, 0, 0, 0))
  outline: none;
}
.input:focus {
  border-color: rgba(0, 0, 0, 0))
  outline: none;
}
::v-deep.basecss .el-input {
  border-color: rgba(0, 0, 0, 0) !important;
  background-color: rgba(0, 0, 0, 0) !important;
}
::v-deep.basecss .el-input--small .el-input__inner {
  border-color: rgba(0, 0, 0, 0) !important;
  background-color: rgba(0, 0, 0, 0) !important;
}
::v-deep.basecss .el-input--small .el-input__inner {
  border-color: rgba(0, 0, 0, 0) !important;
  background-color: rgba(0, 0, 0, 0) !important;
}
/* ::v-deep .basecss .el-input .el-input--small .el-input__inner {
  border-color: rgba(0, 0, 0, 0);
  background-color: rgba(0, 0, 0, 0);
} */
::v-deep.input {
  border-style: none;
}
::v-deep .el-radio {
  margin-right: 15px;
}
::v-deep.el-input--suffix .el-input__inner {
  padding-right: 0px;
}
.el-checkbox {
  margin-right: 2px !important;
}
::v-deep .el-checkbox__label {
  padding-left: 2px;
}
::v-deep .el-collapse-item__content {
  padding-bottom: 0px !important;
  font-size: 12px;
}
::v-deep .el-collapse-item__header {
  height: 30px;
  line-height: 30px;
  font-weight: 900;
}
::v-deep .Listclass .vxe-table .vxe-cell {
  width: 100% !important;
  white-space: normal;
  word-break: break-word;
  padding: 0 5px;
}
::v-deep .chkok {
  font-weight: bold;
  background-color: rgb(169, 169, 169) !important;
  background-image: linear-gradient(rgb(0, 188, 245), rgb(2, 170, 221), rgb(0, 188, 245)) !important;
  color: white;
}
::v-deep .vxe-table .vxe-body--row.chkok.row--hover td {
  background-image: linear-gradient(rgb(0, 188, 245), rgb(46, 137, 211), rgb(0, 188, 245)) !important;
  color: white !important;
}
::v-deep .vxe-table .vxe-body--row.chkok.row--current td {
  background-image: linear-gradient(rgb(0, 188, 245), rgb(0, 104, 189), rgb(0, 188, 245)) !important;
  color: white;
}
::v-deep .lackrule {
  font-weight: bold;
  background-color: rgb(236, 98, 98) !important;
  background-image: linear-gradient(rgb(228, 97, 97), rgb(211, 72, 72) rgb(228, 97, 97)) !important;
  color: white;
}
::v-deep .vxe-table .vxe-body--row.lackrule.row--hover td {
  background-color: rgb(226, 63, 63);
  background-image: linear-gradient(rgb(228, 97, 97), rgb(206, 45, 45) rgb(228, 97, 97)) !important;
  color: white;
}
::v-deep .vxe-table .vxe-body--row.lackrule.row--current td {
  background-color: rgb(235, 21, 21);
  background-image: linear-gradient(rgb(228, 97, 97), rgb(189, 34, 34) rgb(228, 97, 97)) !important;
  color: white;
}
/* loading */
.loading {
  width: 55px;
  height: 60px;
  margin: 0 auto;
  margin-top: 0px;
  position: relative;
  -webkit-animation: load 3s linear infinite;
}
.loading div {
  width: 100%;
  height: 100%;
  position: absolute;
}
.loading span {
  display: inline-block;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #99cc66;
  position: absolute;
  left: 50%;
  margin-top: -10px;
  margin-left: -10px;
  -webkit-animation: changeBgColor 3s ease infinite;
}
@-webkit-keyframes load {
  0% {
      -webkit-transform: rotate(0deg);
  }
  33.3% {
      -webkit-transform: rotate(120deg);
  }
  66.6% {
      -webkit-transform: rotate(240deg);
  }
  100% {
      -webkit-transform: rotate(360deg);
  }
}
@-webkit-keyframes changeBgColor {
  0%,
  100% {
      background: #99cc66;
  }
  33.3% {
      background: #ffff66;
  }
  66.6% {
      background: #ff6666;
  }
}
.loading div:nth-child(2) {
  -webkit-transform: rotate(120deg);
}
.loading div:nth-child(3) {
  -webkit-transform: rotate(240deg);
}
.loading div:nth-child(2) span {
  -webkit-animation-delay: 1s;
}
.loading div:nth-child(3) span {
  -webkit-animation-delay: 2s;
}
</style>
